[rott-commits] r263 - trunk/rott

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Wed Feb 15 07:25:34 EST 2012


Author: fabian
Date: 2012-02-15 07:25:34 -0500 (Wed, 15 Feb 2012)
New Revision: 263

Modified:
   trunk/rott/rt_build.c
   trunk/rott/rt_draw.c
   trunk/rott/rt_game.c
   trunk/rott/rt_main.c
   trunk/rott/rt_map.c
   trunk/rott/rt_str.c
   trunk/rott/rt_ted.c
   trunk/rott/w_wad.c
Log:
Fix format string vulnerabilities.

Modified: trunk/rott/rt_build.c
===================================================================
--- trunk/rott/rt_build.c	2011-11-07 09:21:17 UTC (rev 262)
+++ trunk/rott/rt_build.c	2012-02-15 12:25:34 UTC (rev 263)
@@ -543,7 +543,7 @@
    DrawPlanePosts();
    oldfont=CurrentFont;
    CurrentFont = (font_t *)W_CacheLumpName ("newfnt1", PU_CACHE, Cvt_font_t, 1);
-   US_MeasureStr (&width, &height, titlestring);
+   US_MeasureStr (&width, &height, "%s", titlestring);
    US_ClippedPrint ((320-width)>>1, MENUTITLEY-titleyoffset, titlestring);
    CurrentFont=oldfont;
    FlipPage();

Modified: trunk/rott/rt_draw.c
===================================================================
--- trunk/rott/rt_draw.c	2011-11-07 09:21:17 UTC (rev 262)
+++ trunk/rott/rt_draw.c	2012-02-15 12:25:34 UTC (rev 263)
@@ -4464,7 +4464,7 @@
       if (i>3)
          I_Delay(50);
 
-      US_MeasureStr (&width, &height, &(EndCinematicText[i][0]));
+      US_MeasureStr (&width, &height, "%s", &(EndCinematicText[i][0]));
       if (LastScan !=0)
          break;
 
@@ -4555,11 +4555,11 @@
 
    if (LastScan == 0)
       {
-      US_MeasureStr (&width, &height, NextGameString1);
+      US_MeasureStr (&width, &height, "%s", NextGameString1);
       x=(320-width)>>1;
       y=(200-height)>>1;
       US_ClippedPrint (x,y-6, NextGameString1);
-      US_MeasureStr (&width, &height, NextGameString2);
+      US_MeasureStr (&width, &height, "%s", NextGameString2);
       x=(320-width)>>1;
       y=(200-height)>>1;
       US_ClippedPrint (x,y+6, NextGameString2);
@@ -4912,7 +4912,7 @@
    int time1,time2;
 
    LastScan=0;
-   US_MeasureStr (&width, &height, string);
+   US_MeasureStr (&width, &height, "%s", string);
 
    x=(320-width)>>1;
    y=cy-(height>>1);
@@ -5578,7 +5578,7 @@
    DrawNormalSprite(0,yoffset,lump);
 
    CurrentFont=smallfont;
-   US_MeasureStr (&width, &height, string);
+   US_MeasureStr (&width, &height, "%s", string);
    x=(320-width)>>1;
    y=190-height;
    US_ClippedPrint (x, y, string);
@@ -5674,7 +5674,7 @@
          CurrentFont=smallfont;
       else
          CurrentFont=tinyfont;
-      US_MeasureStr (&width, &height, &(Credits[i].text[0]));
+      US_MeasureStr (&width, &height, "%s", &(Credits[i].text[0]));
       x=(320-width)>>1;
       y=Credits[i].endy;
       US_ClippedPrint (x, y+4, &Credits[i].text[0]);
@@ -5706,7 +5706,7 @@
       CurrentFont=smallfont;
    else
       CurrentFont=tinyfont;
-   US_MeasureStr (&width, &height, &(Credits[num].text[0]));
+   US_MeasureStr (&width, &height, "%s", &(Credits[num].text[0]));
 
    x=(320-width)>>1;
    y=Credits[num].endy;

Modified: trunk/rott/rt_game.c
===================================================================
--- trunk/rott/rt_game.c	2011-11-07 09:21:17 UTC (rev 262)
+++ trunk/rott/rt_game.c	2012-02-15 12:25:34 UTC (rev 263)
@@ -1033,12 +1033,12 @@
 
                // Shorten name to fit into point count
                length = strlen( codename );
-               US_MeasureStr( &width, &height, codename );
+               US_MeasureStr( &width, &height, "%s", codename );
                while( width > KILLS_WIDTH )
                   {
                   codename[ length ] = 0;
                   length--;
-                  US_MeasureStr( &width, &height, codename );
+                  US_MeasureStr( &width, &height, "%s", codename );
                   }
 
                // Draw name

Modified: trunk/rott/rt_main.c
===================================================================
--- trunk/rott/rt_main.c	2011-11-07 09:21:17 UTC (rev 262)
+++ trunk/rott/rt_main.c	2012-02-15 12:25:34 UTC (rev 263)
@@ -876,13 +876,13 @@
 					if (access (tempstr, 0) != 0) { //try open again
 						//stil no useful filename
 						strcat (tempstr," not found, skipping RTL file ");
-						printf(tempstr);
+						printf("%s", tempstr);
 						goto NoRTL;
 					}
 			   }
 			   if((f = fopen( tempstr, "r" )) == NULL ){ //try opnong file
 					strcat (tempstr," not could not be opened, skipping RTL file ");
-					printf(tempstr);
+					printf("%s", tempstr);
 					goto NoRTL;
 			   }else{
 					fread(buf,3,3,f);//is the 3 first letters RTL (RTC)
@@ -891,7 +891,7 @@
 						GameLevels.avail++;
 						strcpy (buf,"Adding ");
 						strcat (buf,tempstr);
-						printf(buf);
+						printf("%s", buf);
 					}
 					fclose(f);
 			   }
@@ -912,13 +912,13 @@
 					if (access (tempstr, 0) != 0) { //try open again
 						//stil no useful filename
 						strcat (tempstr," not found, skipping RTC file ");
-						printf(tempstr);
+						printf("%s", tempstr);
 						goto NoRTL;
 					}
 			   }
 			   if((f = fopen( tempstr, "r" )) == NULL ){ //try opening file
 					strcat (tempstr," not could not be opened, skipping RTC file ");
-					printf(tempstr);
+					printf("%s", tempstr);
 					goto NoRTL;
 			   }else{
 					fread(buf,3,3,f);//is the 3 first letters RTL (RTC)
@@ -927,7 +927,7 @@
 						BattleLevels.avail++;
 						strcpy (buf,"Adding ");
 						strcat (buf,tempstr);
-						printf(buf);
+						printf("%s", buf);
 					}
 					fclose(f);
 			   }
@@ -1500,7 +1500,7 @@
 //                     break;
                   }
                CurrentFont=smallfont;
-               US_MeasureStr (&width, &height, str);
+               US_MeasureStr (&width, &height, "%s", str);
                US_ClippedPrint ((320-width)>>1, 180, str);
                VW_UpdateScreen();
                MenuFadeIn();

Modified: trunk/rott/rt_map.c
===================================================================
--- trunk/rott/rt_map.c	2011-11-07 09:21:17 UTC (rev 262)
+++ trunk/rott/rt_map.c	2012-02-15 12:25:34 UTC (rev 263)
@@ -782,14 +782,14 @@
    PrintX = 2;
    PrintY = 2;
    strcpy (&temp[0], &(LevelName[0]));
-   US_MeasureStr (&width, &height, &temp[0]);
+   US_MeasureStr (&width, &height, "%s", &temp[0]);
 
    VWB_TBar (0, 0, 320, height+4);
 
    US_BufPrint (&temp[0]);
 
    strcpy (&temp[0], "TAB=EXIT");
-   US_MeasureStr (&width, &height, &temp[0]);
+   US_MeasureStr (&width, &height, "%s", &temp[0]);
 
    PrintX = 316-width;
    PrintY = 2;
@@ -797,7 +797,7 @@
    US_BufPrint (&temp[0]);
 
    strcpy (&temp[0], "< > CHANGE BACKGROUND COLOR");
-   US_MeasureStr (&width, &height, &temp[0]);
+   US_MeasureStr (&width, &height, "%s", &temp[0]);
 
    PrintX = (320-width)>>1;
    PrintY = 2;

Modified: trunk/rott/rt_str.c
===================================================================
--- trunk/rott/rt_str.c	2011-11-07 09:21:17 UTC (rev 262)
+++ trunk/rott/rt_str.c	2012-02-15 12:25:34 UTC (rev 263)
@@ -2002,7 +2002,7 @@
    char    *ptr;
    if (MONOPRESENT==false)
       {
-      Debug(fmt);
+      Debug("%s", fmt);
       return 0;
       }
    va_start( argptr, fmt );

Modified: trunk/rott/rt_ted.c
===================================================================
--- trunk/rott/rt_ted.c	2011-11-07 09:21:17 UTC (rev 262)
+++ trunk/rott/rt_ted.c	2012-02-15 12:25:34 UTC (rev 263)
@@ -1073,7 +1073,7 @@
       else
 			memcpy (&buf[0], "COMM-BAT", 8);
 
-      US_MeasureStr (&width, &height, &buf[0]);
+      US_MeasureStr (&width, &height, "%s", &buf[0]);
       VWB_TBar (PrintX-2, PrintY-2, width+4, height+4);
       US_BufPrint (&buf[0]);
 
@@ -1092,7 +1092,7 @@
          {
          itoa( gamestate.mapon + 1, &buf[ 5 ], 10 );
          }
-      US_MeasureStr (&width, &height, &buf[0]);
+      US_MeasureStr (&width, &height, "%s", &buf[0]);
       PrintX = (300-width);
       VWB_TBar (PrintX-2, PrintY-2, width+4, height+4);
       US_BufPrint (&buf[0]);
@@ -1107,7 +1107,7 @@
       else
          strcpy (temp, &(LevelName[0]));
 
-      US_MeasureStr (&width, &height, &temp[0]);
+      US_MeasureStr (&width, &height, "%s", &temp[0]);
 
       PrintX = (320-width) >> 1;
       PrintY = PRECACHESTRINGY;
@@ -1270,7 +1270,7 @@
          CurrentFont = newfont1;//smallfont;
 
          strcpy( buf, "Press Any Key" );
-         US_MeasureStr (&width, &height, &buf[ 0 ] );
+         US_MeasureStr (&width, &height, "%s", &buf[ 0 ] );
          PrintX = (iGLOBAL_SCREENWIDTH-(width)) / 2;
          PrintY = WHratio*iGLOBAL_SCREENHEIGHT;//162;
          //VWB_TBar (PrintX-2, PrintY-2, width+4, height+4);

Modified: trunk/rott/w_wad.c
===================================================================
--- trunk/rott/w_wad.c	2011-11-07 09:21:17 UTC (rev 262)
+++ trunk/rott/w_wad.c	2012-02-15 12:25:34 UTC (rev 263)
@@ -100,7 +100,7 @@
 			strcpy (buf,"Error, Could not find User file '");
 			strcat (buf,filename);
 			strcat (buf,"', ignoring file");
-			printf(buf);
+			printf("%s", buf);
 		}
 		//bna section end
 



More information about the rott-commits mailing list