r229 - trunk/rott
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Sat May 24 02:34:22 EDT 2008
Author: jwrdegoede
Date: 2008-05-24 02:34:21 -0400 (Sat, 24 May 2008)
New Revision: 229
Modified:
trunk/rott/rt_main.c
trunk/rott/scriplib.c
Log:
Fix a bufferoverrun and 2 wrong memset invocations
Modified: trunk/rott/rt_main.c
===================================================================
--- trunk/rott/rt_main.c 2008-05-24 06:29:59 UTC (rev 228)
+++ trunk/rott/rt_main.c 2008-05-24 06:34:21 UTC (rev 229)
@@ -3241,7 +3241,7 @@
* unlike in CONVERT.EXE.
*/
- memset (&pcxHDR, sizeof(PCX_HEADER), 0);
+ memset (&pcxHDR, 0, sizeof(PCX_HEADER));
pcxHDR.manufacturer = 10;
pcxHDR.version = 5;
@@ -3274,7 +3274,7 @@
//
SafeWrite(pcxhandle,&pcxHDR, sizeof (PCX_HEADER));
- memset (buffer1, GAP_SIZE, 0);
+ memset (buffer1, 0, GAP_SIZE);
SafeWrite (pcxhandle, &buffer1, GAP_SIZE);
Modified: trunk/rott/scriplib.c
===================================================================
--- trunk/rott/scriplib.c 2008-05-24 06:29:59 UTC (rev 228)
+++ trunk/rott/scriplib.c 2008-05-24 06:34:21 UTC (rev 229)
@@ -43,7 +43,7 @@
char token[MAXTOKEN];
char name[MAXTOKEN*2];
-char scriptfilename[30];
+char scriptfilename[512];
char *scriptbuffer,*script_p,*scriptend_p;
int scriptline;
boolean endofscript;
@@ -63,7 +63,7 @@
size = LoadFile (filename, (void **)&scriptbuffer);
- strcpy(&scriptfilename[0],filename);
+ snprintf(scriptfilename, sizeof(scriptfilename), "%s", filename);
script_p = scriptbuffer;
scriptend_p = script_p + size;
scriptline = 1;
More information about the rott-commits
mailing list