Make barrel/flash model name buffer safe

This commit is contained in:
Zack Middleton 2015-01-12 22:33:42 -06:00
parent af617bc0e6
commit af8acbd7a9
3 changed files with 14 additions and 21 deletions

View file

@ -655,19 +655,16 @@ void CG_RegisterWeapon( int weaponNum ) {
weaponInfo->ammoModel = trap_R_RegisterModel( ammo->world_model[0] );
}
strcpy( path, item->world_model[0] );
COM_StripExtension(path, path, sizeof(path));
strcat( path, "_flash.md3" );
COM_StripExtension( item->world_model[0], path, sizeof(path) );
Q_strcat( path, sizeof(path), "_flash.md3" );
weaponInfo->flashModel = trap_R_RegisterModel( path );
strcpy( path, item->world_model[0] );
COM_StripExtension(path, path, sizeof(path));
strcat( path, "_barrel.md3" );
COM_StripExtension( item->world_model[0], path, sizeof(path) );
Q_strcat( path, sizeof(path), "_barrel.md3" );
weaponInfo->barrelModel = trap_R_RegisterModel( path );
strcpy( path, item->world_model[0] );
COM_StripExtension(path, path, sizeof(path));
strcat( path, "_hand.md3" );
COM_StripExtension( item->world_model[0], path, sizeof(path) );
Q_strcat( path, sizeof(path), "_hand.md3" );
weaponInfo->handsModel = trap_R_RegisterModel( path );
if ( !weaponInfo->handsModel ) {

View file

@ -88,15 +88,13 @@ tryagain:
}
if ( weaponNum == WP_MACHINEGUN || weaponNum == WP_GAUNTLET || weaponNum == WP_BFG ) {
strcpy( path, item->world_model[0] );
COM_StripExtension( path, path, sizeof(path) );
strcat( path, "_barrel.md3" );
COM_StripExtension( item->world_model[0], path, sizeof(path) );
Q_strcat( path, sizeof(path), "_barrel.md3" );
pi->barrelModel = trap_R_RegisterModel( path );
}
strcpy( path, item->world_model[0] );
COM_StripExtension( path, path, sizeof(path) );
strcat( path, "_flash.md3" );
COM_StripExtension( item->world_model[0], path, sizeof(path) );
Q_strcat( path, sizeof(path), "_flash.md3" );
pi->flashModel = trap_R_RegisterModel( path );
switch( weaponNum ) {

View file

@ -89,15 +89,13 @@ tryagain:
}
if ( weaponNum == WP_MACHINEGUN || weaponNum == WP_GAUNTLET || weaponNum == WP_BFG ) {
strcpy( path, item->world_model[0] );
COM_StripExtension(path, path, sizeof(path));
strcat( path, "_barrel.md3" );
COM_StripExtension( item->world_model[0], path, sizeof(path) );
Q_strcat( path, sizeof(path), "_barrel.md3" );
pi->barrelModel = trap_R_RegisterModel( path );
}
strcpy( path, item->world_model[0] );
COM_StripExtension(path, path, sizeof(path));
strcat( path, "_flash.md3" );
COM_StripExtension( item->world_model[0], path, sizeof(path) );
Q_strcat( path, sizeof(path), "_flash.md3" );
pi->flashModel = trap_R_RegisterModel( path );
switch( weaponNum ) {