aboutsummaryrefslogtreecommitdiff
path: root/games
diff options
context:
space:
mode:
authorAlex Dupre <ale@FreeBSD.org>2005-09-17 11:28:01 +0000
committerAlex Dupre <ale@FreeBSD.org>2005-09-17 11:28:01 +0000
commit6f93d50934b52003fcd40dc180ea48588ce20dc1 (patch)
tree9ce013bd9ebc06e3d17168a4ff55de213d06c580 /games
parent0301cfd2549ac3606bd7a88ad862e76219e97063 (diff)
downloadports-6f93d50934b52003fcd40dc180ea48588ce20dc1.tar.gz
ports-6f93d50934b52003fcd40dc180ea48588ce20dc1.zip
Fix possible buffer overflows and fix core dump on 5.X.
Approved by: maintainer
Notes
Notes: svn path=/head/; revision=143004
Diffstat (limited to 'games')
-rw-r--r--games/tetrinet-x/Makefile1
-rw-r--r--games/tetrinet-x/files/patch-src::main.c43
2 files changed, 31 insertions, 13 deletions
diff --git a/games/tetrinet-x/Makefile b/games/tetrinet-x/Makefile
index 36c1f9b33bc4..3de7eab9d8dd 100644
--- a/games/tetrinet-x/Makefile
+++ b/games/tetrinet-x/Makefile
@@ -7,6 +7,7 @@
PORTNAME= tetrinet-x
PORTVERSION= 1.13.16
+PORTREVISION= 1
CATEGORIES= games
MASTER_SITES= http://www.giovannelli.it/~gmarco/files/ \
ftp://ftp.dementia.nu/tetrinet/servers/tetrix/
diff --git a/games/tetrinet-x/files/patch-src::main.c b/games/tetrinet-x/files/patch-src::main.c
index a9939a7d746d..8f453d3fe036 100644
--- a/games/tetrinet-x/files/patch-src::main.c
+++ b/games/tetrinet-x/files/patch-src::main.c
@@ -1,6 +1,6 @@
--- src/main.c.orig Thu Dec 24 06:24:50 1998
-+++ src/main.c Thu Jun 17 10:06:39 2004
-@@ -319,12 +319,10 @@
++++ src/main.c Sat Sep 17 13:24:27 2005
+@@ -319,40 +319,27 @@
/* lvprintf( priority, same as printf ) - Logs to the log IF priority is smaller */
/* or equal to game.verbose */
@@ -11,12 +11,22 @@
- char *format; va_list va; static char SBUF2[768];int priority;
- va_start(va);
- priority=va_arg(va,int);format=va_arg(va,char *);
-+ va_list va; static char SBUF2[768];
-+ va_start(va, format);
- vsprintf(SBUF2,format,va);
- if (strlen(SBUF2)>512)
- {
-@@ -338,15 +336,14 @@
+- vsprintf(SBUF2,format,va);
+- if (strlen(SBUF2)>512)
+- {
+- SBUF2[512]=0; /* truncate string. Of course, by now we have buffer overrun ;) */
+- }
+-
+- if (priority <= game.verbose)
++ if (priority <= game.verbose) {
++ va_list va; static char SBUF2[768];
++ va_start(va, format);
++ vsnprintf(SBUF2, sizeof(SBUF2),format,va);
+ lprintf(SBUF2);
+-
+- va_end(va);
++ va_end(va);
++ }
}
/* lprintf( same as printf ) - Logs to the log. */
@@ -31,11 +41,18 @@
char *P;
time_t cur_time;
- va_start(va);
+- format=va_arg(va,char *);
+- vsprintf(SBUF2,format,va);
+- if (strlen(SBUF2)>512)
+- {
+- SBUF2[512]=0; /* truncate string. Of course, by now we have buffer overrun ;) */
+- }
+ va_start(va, format);
- format=va_arg(va,char *);
- vsprintf(SBUF2,format,va);
- if (strlen(SBUF2)>512)
-@@ -2462,7 +2459,7 @@
++ vsnprintf(SBUF2, sizeof(SBUF2),format,va);
+
+ file_out = fopen(FILE_LOG,"a");
+ if (file_out != NULL)
+@@ -2462,7 +2449,7 @@
/* Winlist - Returns Winlist */
if (!strcasecmp(buf,"getwinlist"))
{
@@ -44,7 +61,7 @@
for(i=0;i<MAXWINLIST;i++)
{
if(winlist[i].inuse)
-@@ -3071,4 +3068,4 @@
+@@ -3071,4 +3058,4 @@
}