Add string length checking to function COM_StripExtension. This fixes the R_RemapShader buffer overflow exploit that can be found here:
http://milw0rm.com/exploits/1750
This commit is contained in:
1 parent
2e368c02a6
commit
d21411452e
13 files changed
+22
-22
No files matched your search
+2
-2
@@ -4958,7 +4958,7 @@ static void UI_BuildQ3Model_List( void )
|
||||
int numfiles;
|
||||
char dirlist[2048];
|
||||
char filelist[2048];
|
||||
char skinname[64];
|
||||
char skinname[MAX_QPATH];
|
||||
char scratch[256];
|
||||
char* dirptr;
|
||||
char* fileptr;
|
||||
@@ -4988,7 +4988,7 @@ static void UI_BuildQ3Model_List( void )
|
||||
{
|
||||
filelen = strlen(fileptr);
|
||||
|
||||
COM_StripExtension(fileptr,skinname);
|
||||
COM_StripExtension(fileptr, skinname, sizeof(skinname));
|
||||
|
||||
// look for icon_????
|
||||
if (Q_stricmpn(skinname, "icon_", 5) == 0 && !(Q_stricmp(skinname,"icon_blue") == 0 || Q_stricmp(skinname,"icon_red") == 0))
|
||||
|
||||
@@ -90,13 +90,13 @@ tryagain:
|
||||
|
||||
if ( weaponNum == WP_MACHINEGUN || weaponNum == WP_GAUNTLET || weaponNum == WP_BFG ) {
|
||||
strcpy( path, item->world_model[0] );
|
||||
COM_StripExtension( path, path );
|
||||
COM_StripExtension(path, path, sizeof(path));
|
||||
strcat( path, "_barrel.md3" );
|
||||
pi->barrelModel = trap_R_RegisterModel( path );
|
||||
}
|
||||
|
||||
strcpy( path, item->world_model[0] );
|
||||
COM_StripExtension( path, path );
|
||||
COM_StripExtension(path, path, sizeof(path));
|
||||
strcat( path, "_flash.md3" );
|
||||
pi->flashModel = trap_R_RegisterModel( path );
|
||||
|
||||
|
||||
Reference in new issue
Block a user