From: Rudolf Polzer Date: Sat, 8 Jan 2011 19:59:46 +0000 (+0100) Subject: fix two bugs cppcheck found X-Git-Tag: xonotic-v0.5.0~70 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=6ce0c65e7716ae089adc3484cc2faaedd9e7730c;p=xonotic%2Fnetradiant.git fix two bugs cppcheck found --- diff --git a/tools/quake3/q3map2/main.c b/tools/quake3/q3map2/main.c index 63e63697..074a4a43 100644 --- a/tools/quake3/q3map2/main.c +++ b/tools/quake3/q3map2/main.c @@ -989,8 +989,8 @@ int AnalyzeBSP( int argc, char **argv ) lump = (byte*) header + offset; lumpInt = LittleLong( (int) *((int*) lump) ); lumpFloat = LittleFloat( (float) *((float*) lump) ); - memcpy( lumpString, (char*) lump, (length < 1024 ? length : 1024) ); - lumpString[ 1024 ] = '\0'; + memcpy( lumpString, (char*) lump, (length < sizeof(lumpString) ? length : sizeof(lumpString)-1) ); + lumpString[ sizeof(lumpString)-1 ] = '\0'; /* print basic lump info */ Sys_Printf( "Lump: %d\n", i ); diff --git a/tools/quake3/q3map2/model.c b/tools/quake3/q3map2/model.c index 05213cf1..74e47a8a 100644 --- a/tools/quake3/q3map2/model.c +++ b/tools/quake3/q3map2/model.c @@ -229,7 +229,6 @@ void InsertModel( const char *name, int skin, int frame, m4x4_t transform, remap char *skinfilecontent; int skinfilesize; char *skinfileptr, *skinfilenextptr; - FILE *skinfilehandle; /* get model */ @@ -240,7 +239,6 @@ void InsertModel( const char *name, int skin, int frame, m4x4_t transform, remap /* load skin file */ snprintf(skinfilename, sizeof(skinfilename), "%s_%d.skin", name, skin); skinfilename[sizeof(skinfilename)-1] = 0; - skinfilehandle = fopen(skinfilename, "r"); skinfilesize = vfsLoadFile(skinfilename, (void**) &skinfilecontent, 0); if(skinfilesize < 0 && skin != 0) {