[iortcw] 272/497: All: Fix possible string buffer overflows in cgame and ui

Simon McVittie smcv at debian.org
Fri Sep 8 10:37:06 UTC 2017


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to annotated tag 1.42d
in repository iortcw.

commit 2128a8f3cb2ca2a22ae6a7806499ea657e7dd5ff
Author: M4N4T4RMS at gmail.com <M4N4T4RMS at gmail.com@e65d2741-a53d-b2dc-ae96-bb75fa5e4c4a>
Date:   Tue Jan 13 22:40:55 2015 +0000

    All:  Fix possible string buffer overflows in cgame and ui
---
 MP/code/cgame/cg_weapons.c | 58 +++++++++++++++++++++++----------------------
 MP/code/ui/ui_main.c       | 30 +++++++++++------------
 MP/code/ui/ui_players.c    |  7 +++---
 SP/code/cgame/cg_weapons.c | 59 +++++++++++++++++++++++-----------------------
 SP/code/ui/ui_main.c       | 32 ++++++++++++-------------
 SP/code/ui/ui_players.c    |  7 +++---
 6 files changed, 97 insertions(+), 96 deletions(-)

diff --git a/MP/code/cgame/cg_weapons.c b/MP/code/cgame/cg_weapons.c
index 9f52f3c..8229c90 100644
--- a/MP/code/cgame/cg_weapons.c
+++ b/MP/code/cgame/cg_weapons.c
@@ -1157,40 +1157,42 @@ void CG_RegisterWeapon( int weaponNum ) {
 	}
 
 	if ( item->world_model[W_FP_MODEL] ) {
-		strcpy( comppath, item->world_model[W_FP_MODEL] );  // first try the fp view weap
+		Q_strncpyz( comppath, item->world_model[W_FP_MODEL], sizeof(comppath) ); // first try the fp view weap
 	} else if ( item->world_model[W_TP_MODEL] ) {
-		strcpy( comppath, item->world_model[W_TP_MODEL] );  // not there, use the standard view hand
+		Q_strncpyz( comppath, item->world_model[W_TP_MODEL], sizeof(comppath) ); // not there, use the standard view hand
 	}
+
 	if ( !cg_drawFPGun.integer && item->world_model[W_TP_MODEL] ) { // then if it didn't find the 1st person one or you are set to not use one
-		strcpy( comppath, item->world_model[W_TP_MODEL] );  // use the standard view hand
+		Q_strncpyz( comppath, item->world_model[W_TP_MODEL], sizeof(comppath) ); // use the standard view hand
 	}
+
 	for ( i = W_TP_MODEL; i < W_NUM_TYPES; i++ )
 	{
 		int j;
 		qboolean bail = qfalse;
 
 		if ( !item->world_model[i] ) {
-			strcpy( path, comppath );
+			Q_strncpyz( path, comppath, sizeof(path) );
 		} else {
-			strcpy( path, item->world_model[i] );
+			Q_strncpyz( path, item->world_model[i], sizeof(path) );
 		}
 
-		COM_StripExtension(path, path, sizeof(path));
-		strcat( path, "_flash.md3" );
+		COM_StripExtension( path, path, sizeof(path) );
+		Q_strcat( path, sizeof(path), "_flash.md3" );
 		weaponInfo->flashModel[i] = trap_R_RegisterModel( path );
 
 
 		for ( j = 0; j < W_MAX_PARTS; j++ ) {
 			if ( !item->world_model[i] ) {
-				strcpy( path, comppath );
+				Q_strncpyz( path, comppath, sizeof(path) );
 			} else {
-				strcpy( path, item->world_model[i] );
+				Q_strncpyz( path, item->world_model[i], sizeof(path) );
 			}
-			COM_StripExtension(path, path, sizeof(path));
+			COM_StripExtension( path, path, sizeof(path) );
 			if ( j == W_PART_1 ) {
-				strcat( path, "_barrel.md3" );
+				Q_strcat( path, sizeof(path), "_barrel.md3" );
 			} else {
-				strcat( path, va( "_barrel%d.md3", j + 1 ) );
+				Q_strcat( path, sizeof(path), va( "_barrel%d.md3", j + 1 ) );
 			}
 
 			if ( !bail || weaponNum == WP_MAUSER ) {
@@ -1207,12 +1209,12 @@ void CG_RegisterWeapon( int weaponNum ) {
 		// used for spinning belt on venom
 		if ( i == W_FP_MODEL ) {
 			if ( !item->world_model[2] ) {
-				strcpy( path, comppath );
+				Q_strncpyz( path, comppath, sizeof(path) );
 			} else {
-				strcpy( path, item->world_model[2] );
+				Q_strncpyz( path, item->world_model[2], sizeof(path) );
 			}
-			COM_StripExtension(path, path, sizeof(path));
-			strcat( path, "_barrel6b.md3" );
+			COM_StripExtension( path, path, sizeof(path) );
+			Q_strcat( path, sizeof(path), "_barrel6b.md3" );
 			weaponInfo->partModels[i][W_PART_7] = trap_R_RegisterModel( path );
 		}
 	}
@@ -1222,22 +1224,22 @@ void CG_RegisterWeapon( int weaponNum ) {
 	if ( weaponNum == WP_MAUSER || weaponNum == WP_GARAND ) {
 
 		if ( !item->world_model[W_FP_MODEL] ) {
-			strcpy( path, comppath );
+			Q_strncpyz( path, comppath, sizeof(path) );
 		} else {
-			strcpy( path, item->world_model[W_FP_MODEL] );
+			Q_strncpyz( path, item->world_model[W_FP_MODEL], sizeof(path) );
 		}
-		COM_StripExtension(path, path, sizeof(path));
-		strcat( path, "_scope.md3" );
+		COM_StripExtension( path, path, sizeof(path) );
+		Q_strcat( path, sizeof(path), "_scope.md3" );
 		weaponInfo->modModel[0] = trap_R_RegisterModel( path );
 	}
 
 	if ( !item->world_model[W_FP_MODEL] ) {
-		strcpy( path, comppath );
+		Q_strncpyz( path, comppath, sizeof(path) );
 	} else {
-		strcpy( path, item->world_model[W_FP_MODEL] );
+		Q_strncpyz( path, item->world_model[W_FP_MODEL], sizeof(path) );
 	}
-	COM_StripExtension(path, path, sizeof(path));
-	strcat( path, "_hand.md3" );
+	COM_StripExtension( path, path, sizeof(path) );
+	Q_strcat( path, sizeof(path), "_hand.md3" );
 	weaponInfo->handsModel = trap_R_RegisterModel( path );
 
 	if ( !weaponInfo->handsModel ) {
@@ -1246,12 +1248,12 @@ void CG_RegisterWeapon( int weaponNum ) {
 
 //----(SA)	weapon pickup 'stand'
 	if ( !item->world_model[W_TP_MODEL] ) {
-		strcpy( path, comppath );
+		Q_strncpyz( path, comppath, sizeof(path) );
 	} else {
-		strcpy( path, item->world_model[W_TP_MODEL] );
+		Q_strncpyz( path, item->world_model[W_TP_MODEL], sizeof(path) );
 	}
-	COM_StripExtension(path, path, sizeof(path));
-	strcat( path, "_stand.md3" );
+	COM_StripExtension( path, path, sizeof(path) );
+	Q_strcat( path, sizeof(path), "_stand.md3" );
 	weaponInfo->standModel = trap_R_RegisterModel( path );
 //----(SA)	end
 
diff --git a/MP/code/ui/ui_main.c b/MP/code/ui/ui_main.c
index 4185249..a1309ae 100644
--- a/MP/code/ui/ui_main.c
+++ b/MP/code/ui/ui_main.c
@@ -1443,7 +1443,7 @@ void UI_Load( void ) {
 	menuDef_t *menu = Menu_GetFocused();
 	char *menuSet = UI_Cvar_VariableString( "ui_menuFiles" );
 	if ( menu && menu->window.name ) {
-		strcpy( lastName, menu->window.name );
+		Q_strncpyz(lastName, menu->window.name, sizeof(lastName));
 	}
 	if ( menuSet == NULL || menuSet[0] == '\0' ) {
 		menuSet = "ui_mp/menus.txt";
@@ -1780,16 +1780,16 @@ static void UI_DrawPlayerModel( rectDef_t *rect ) {
 		}
 		// -NERVE - SMF
 
-		strcpy( head, UI_Cvar_VariableString( "headmodel" ) );
+		Q_strncpyz(head, UI_Cvar_VariableString("headmodel"), sizeof(head));
 		if ( !q3Model ) {
 			q3Model = qtrue;
 			updateModel = qtrue;
 		}
 		team[0] = '\0';
 	} else {
-		strcpy( model, UI_Cvar_VariableString( "team_model" ) );
-		strcpy( head, UI_Cvar_VariableString( "team_headmodel" ) );
-		strcpy( team, UI_Cvar_VariableString( "ui_teamName" ) );
+		Q_strncpyz(model, UI_Cvar_VariableString("team_model"), sizeof(model));
+		Q_strncpyz(head, UI_Cvar_VariableString("team_headmodel"), sizeof(head));
+		Q_strncpyz(team, UI_Cvar_VariableString("ui_teamName"), sizeof(team));
 		if ( q3Model ) {
 			q3Model = qfalse;
 			updateModel = qtrue;
@@ -2033,8 +2033,8 @@ static void UI_DrawOpponent( rectDef_t *rect ) {
 
 	if ( updateOpponentModel ) {
 
-		strcpy( model, UI_Cvar_VariableString( "ui_opponentModel" ) );
-		strcpy( headmodel, UI_Cvar_VariableString( "ui_opponentModel" ) );
+		Q_strncpyz(model, UI_Cvar_VariableString("ui_opponentModel"), sizeof(model));
+		Q_strncpyz(headmodel, UI_Cvar_VariableString("ui_opponentModel"), sizeof(headmodel));
 
 		memset( &info2, 0, sizeof( playerInfo_t ) );
 		viewangles[YAW]   = 180 - 10;
@@ -4881,17 +4881,17 @@ static void UI_RunMenuScript( char **args ) {
 			if ( String_Parse( args, &orders ) ) {
 				int selectedPlayer = trap_Cvar_VariableValue( "cg_selectedPlayer" );
 				if ( selectedPlayer < uiInfo.myTeamCount ) {
-					strcpy( buff, orders );
-					trap_Cmd_ExecuteText( EXEC_APPEND, va( buff, uiInfo.teamClientNums[selectedPlayer] ) );
+					Com_sprintf( buff, sizeof( buff ), orders, uiInfo.teamClientNums[selectedPlayer] );
+					trap_Cmd_ExecuteText( EXEC_APPEND, buff );
 					trap_Cmd_ExecuteText( EXEC_APPEND, "\n" );
 				} else {
 					int i;
 					for ( i = 0; i < uiInfo.myTeamCount; i++ ) {
-						if ( Q_stricmp( UI_Cvar_VariableString( "name" ), uiInfo.teamNames[i] ) == 0 ) {
+						if (uiInfo.playerNumber == uiInfo.teamClientNums[i]) {
 							continue;
 						}
-						strcpy( buff, orders );
-						trap_Cmd_ExecuteText( EXEC_APPEND, va( buff, uiInfo.teamNames[i] ) );
+						Com_sprintf( buff, sizeof( buff ), orders, uiInfo.teamClientNums[i] );
+						trap_Cmd_ExecuteText( EXEC_APPEND, buff );
 						trap_Cmd_ExecuteText( EXEC_APPEND, "\n" );
 					}
 				}
@@ -4918,8 +4918,8 @@ static void UI_RunMenuScript( char **args ) {
 			if ( String_Parse( args, &orders ) ) {
 				int selectedPlayer = trap_Cvar_VariableValue( "cg_selectedPlayer" );
 				if ( selectedPlayer < uiInfo.myTeamCount ) {
-					strcpy( buff, orders );
-					trap_Cmd_ExecuteText( EXEC_APPEND, va( buff, uiInfo.teamClientNums[selectedPlayer] ) );
+					Com_sprintf( buff, sizeof( buff ), orders, uiInfo.teamClientNums[selectedPlayer] );
+					trap_Cmd_ExecuteText( EXEC_APPEND, buff );
 					trap_Cmd_ExecuteText( EXEC_APPEND, "\n" );
 				}
 				trap_Key_SetCatcher( trap_Key_GetCatcher() & ~KEYCATCH_UI );
@@ -7310,7 +7310,7 @@ void UI_DrawConnectScreen( qboolean overlay ) {
 	if ( !Q_stricmp( cstate.servername,"localhost" ) ) {
 		Text_PaintCenter(centerPoint, yStart + 48, scale, colorWhite, "Starting up...", ITEM_TEXTSTYLE_SHADOWEDMORE);
 	} else {
-		strcpy( text, va( UI_TranslateString( "Connecting to %s" ), cstate.servername ) );
+		Com_sprintf(text, sizeof(text), UI_TranslateString( "Connecting to %s" ), cstate.servername );
 		Text_PaintCenter( centerPoint, yStart + 48, scale, colorWhite,text, ITEM_TEXTSTYLE_SHADOWEDMORE );
 	}
 
diff --git a/MP/code/ui/ui_players.c b/MP/code/ui/ui_players.c
index 0b2b930..67efd9c 100644
--- a/MP/code/ui/ui_players.c
+++ b/MP/code/ui/ui_players.c
@@ -104,9 +104,8 @@ tryagain:
 		goto tryagain;
 	}
 
-	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 ) {
@@ -1431,7 +1430,7 @@ qboolean UI_RegisterClientModelname( playerInfo_t *pi, const char *modelSkinName
 			}
 		}
 
-		strcpy( skinName, va( "%s%s1", team, playerClass ) );
+		Com_sprintf( skinName, sizeof(skinName), "%s%s1", team, playerClass );
 	}
 	// -NERVE - SMF
 
diff --git a/SP/code/cgame/cg_weapons.c b/SP/code/cgame/cg_weapons.c
index 1ed511a..7da7176 100644
--- a/SP/code/cgame/cg_weapons.c
+++ b/SP/code/cgame/cg_weapons.c
@@ -1112,39 +1112,41 @@ void CG_RegisterWeapon( int weaponNum ) {
 	}
 
 	if ( item->world_model[W_FP_MODEL] ) {
-		strcpy( comppath, item->world_model[W_FP_MODEL] );  // first try the fp view weap
+		Q_strncpyz( comppath, item->world_model[W_FP_MODEL], sizeof(comppath) ); // first try the fp view weap
 	} else if ( item->world_model[W_TP_MODEL] ) {
-		strcpy( comppath, item->world_model[W_TP_MODEL] );  // not there, use the standard view hand
+		Q_strncpyz( comppath, item->world_model[W_TP_MODEL], sizeof(comppath) ); // not there, use the standard view hand
 	}
+
 	if ( !cg_drawFPGun.integer && item->world_model[W_TP_MODEL] ) { // then if it didn't find the 1st person one or you are set to not use one
-		strcpy( comppath, item->world_model[W_TP_MODEL] );  // use the standard view hand
+		Q_strncpyz( comppath, item->world_model[W_TP_MODEL], sizeof(comppath) ); // use the standard view hand
 	}
+
 	for ( i = W_TP_MODEL; i < W_NUM_TYPES; i++ )
 	{
 		int j;
 
 		if ( !item->world_model[i] ) {
-			strcpy( path, comppath );
+			Q_strncpyz( path, comppath, sizeof(path) );
 		} else {
-			strcpy( path, item->world_model[i] );
+			Q_strncpyz( path, item->world_model[i], sizeof(path) );
 		}
 
-		COM_StripExtension(path, path, sizeof(path));
-		strcat( path, "_flash.md3" );
+		COM_StripExtension( path, path, sizeof(path) );
+		Q_strcat( path, sizeof(path), "_flash.md3" );
 		weaponInfo->flashModel[i] = trap_R_RegisterModel( path );
 
 
 		for ( j = 0; j < W_MAX_PARTS; j++ ) {
 			if ( !item->world_model[i] ) {
-				strcpy( path, comppath );
+				Q_strncpyz( path, comppath, sizeof(path) );
 			} else {
-				strcpy( path, item->world_model[i] );
+				Q_strncpyz( path, item->world_model[i], sizeof(path) );
 			}
-			COM_StripExtension(path, path, sizeof(path));
+			COM_StripExtension( path, path, sizeof(path) );
 			if ( j == W_PART_1 ) {
-				strcat( path, "_barrel.md3" );
+				Q_strcat( path, sizeof(path), "_barrel.md3" );
 			} else {
-				strcat( path, va( "_barrel%d.md3", j + 1 ) );
+				Q_strcat( path, sizeof(path), va( "_barrel%d.md3", j + 1 ) );
 			}
 			weaponInfo->wpPartModels[i][j] = trap_R_RegisterModel( path );
 		}
@@ -1152,12 +1154,12 @@ void CG_RegisterWeapon( int weaponNum ) {
 		// used for spinning belt on venom
 		if ( i == W_FP_MODEL ) {
 			if ( !item->world_model[2] ) {
-				strcpy( path, comppath );
+				Q_strncpyz( path, comppath, sizeof(path) );
 			} else {
-				strcpy( path, item->world_model[2] );
+				Q_strncpyz( path, item->world_model[2], sizeof(path) );
 			}
-			COM_StripExtension(path, path, sizeof(path));
-			strcat( path, "_barrel6b.md3" );
+			COM_StripExtension( path, path, sizeof(path) );
+			Q_strcat( path, sizeof(path), "_barrel6b.md3" );
 			weaponInfo->wpPartModels[i][W_PART_7] = trap_R_RegisterModel( path );
 		}
 	}
@@ -1167,37 +1169,36 @@ void CG_RegisterWeapon( int weaponNum ) {
 	if ( weaponNum == WP_MAUSER || weaponNum == WP_GARAND ) {
 
 		if ( !item->world_model[W_FP_MODEL] ) {
-			strcpy( path, comppath );
+			Q_strncpyz( path, comppath, sizeof(path) );
 		} else {
-			strcpy( path, item->world_model[W_FP_MODEL] );
+			Q_strncpyz( path, item->world_model[W_FP_MODEL], sizeof(path) );
 		}
-		COM_StripExtension(path, path, sizeof(path));
-		strcat( path, "_scope.md3" );
+		COM_StripExtension( path, path, sizeof(path) );
+		Q_strcat( path, sizeof(path), "_scope.md3" );
 		weaponInfo->modModel[0] = trap_R_RegisterModel( path );
 	}
 
 	if ( !item->world_model[W_FP_MODEL] ) {
-		strcpy( path, comppath );
+		Q_strncpyz( path, comppath, sizeof(path) );
 	} else {
-		strcpy( path, item->world_model[W_FP_MODEL] );
+		Q_strncpyz( path, item->world_model[W_FP_MODEL], sizeof(path) );
 	}
-	COM_StripExtension(path, path, sizeof(path));
-	strcat( path, "_hand.md3" );
+	COM_StripExtension( path, path, sizeof(path) );
+	Q_strcat( path, sizeof(path), "_hand.md3" );
 	weaponInfo->handsModel = trap_R_RegisterModel( path );
 
 	if ( !weaponInfo->handsModel ) {
 		weaponInfo->handsModel = trap_R_RegisterModel( "models/weapons2/shotgun/shotgun_hand.md3" );
 	}
 
-
 //----(SA)	weapon pickup 'stand'
 	if ( !item->world_model[W_TP_MODEL] ) {
-		strcpy( path, comppath );
+		Q_strncpyz( path, comppath, sizeof(path) );
 	} else {
-		strcpy( path, item->world_model[W_TP_MODEL] );
+		Q_strncpyz( path, item->world_model[W_TP_MODEL], sizeof(path) );
 	}
-	COM_StripExtension(path, path, sizeof(path));
-	strcat( path, "_stand.md3" );
+	COM_StripExtension( path, path, sizeof(path) );
+	Q_strcat( path, sizeof(path), "_stand.md3" );
 	weaponInfo->standModel = trap_R_RegisterModel( path );
 //----(SA)	end
 
diff --git a/SP/code/ui/ui_main.c b/SP/code/ui/ui_main.c
index 172055c..f3718b1 100644
--- a/SP/code/ui/ui_main.c
+++ b/SP/code/ui/ui_main.c
@@ -1124,7 +1124,7 @@ void UI_Load( void ) {
 	menuDef_t *menu = Menu_GetFocused();
 	char *menuSet = UI_Cvar_VariableString( "ui_menuFiles" );
 	if ( menu && menu->window.name ) {
-		strcpy( lastName, menu->window.name );
+		Q_strncpyz(lastName, menu->window.name, sizeof(lastName));
 	}
 	if ( menuSet == NULL || menuSet[0] == '\0' ) {
 #ifdef WOLF_SP_DEMO
@@ -1725,18 +1725,18 @@ static void UI_DrawPlayerModel( rectDef_t *rect ) {
 	static vec3_t moveangles = { 0, 0, 0 };
 
 	if ( trap_Cvar_VariableValue( "ui_Q3Model" ) ) {
-		//	  strcpy(model, UI_Cvar_VariableString("model"));
+		//	Q_strncpyz(model, UI_Cvar_VariableString("model"), sizeof(model));
 		strcpy( model, "multi" );
-		strcpy( head, UI_Cvar_VariableString( "headmodel" ) );
+		Q_strncpyz(head, UI_Cvar_VariableString("headmodel"), sizeof(head));
 		if ( !q3Model ) {
 			q3Model = qtrue;
 			updateModel = qtrue;
 		}
 		team[0] = '\0';
 	} else {
-		strcpy( model, UI_Cvar_VariableString( "team_model" ) );
-		strcpy( head, UI_Cvar_VariableString( "team_headmodel" ) );
-		strcpy( team, UI_Cvar_VariableString( "ui_teamName" ) );
+		Q_strncpyz(model, UI_Cvar_VariableString("team_model"), sizeof(model));
+		Q_strncpyz(head, UI_Cvar_VariableString("team_headmodel"), sizeof(head));
+		Q_strncpyz(team, UI_Cvar_VariableString("ui_teamName"), sizeof(team));
 		if ( q3Model ) {
 			q3Model = qfalse;
 			updateModel = qtrue;
@@ -1965,8 +1965,8 @@ static void UI_DrawOpponent( rectDef_t *rect ) {
 
 	if ( updateOpponentModel ) {
 
-		strcpy( model, UI_Cvar_VariableString( "ui_opponentModel" ) );
-		strcpy( headmodel, UI_Cvar_VariableString( "ui_opponentModel" ) );
+		Q_strncpyz(model, UI_Cvar_VariableString("ui_opponentModel"), sizeof(model));
+		Q_strncpyz(headmodel, UI_Cvar_VariableString("ui_opponentModel"), sizeof(headmodel));
 
 		memset( &info2, 0, sizeof( playerInfo_t ) );
 		viewangles[YAW]   = 180 - 10;
@@ -4896,17 +4896,17 @@ static void UI_RunMenuScript( char **args ) {
 			if ( String_Parse( args, &orders ) ) {
 				int selectedPlayer = trap_Cvar_VariableValue( "cg_selectedPlayer" );
 				if ( selectedPlayer < uiInfo.myTeamCount ) {
-					strcpy( buff, orders );
-					trap_Cmd_ExecuteText( EXEC_APPEND, va( buff, uiInfo.teamClientNums[selectedPlayer] ) );
+					Com_sprintf( buff, sizeof( buff ), orders, uiInfo.teamClientNums[selectedPlayer] );
+					trap_Cmd_ExecuteText( EXEC_APPEND, buff );
 					trap_Cmd_ExecuteText( EXEC_APPEND, "\n" );
 				} else {
 					int i;
 					for ( i = 0; i < uiInfo.myTeamCount; i++ ) {
-						if ( Q_stricmp( UI_Cvar_VariableString( "name" ), uiInfo.teamNames[i] ) == 0 ) {
+						if (uiInfo.playerNumber == uiInfo.teamClientNums[i]) {
 							continue;
 						}
-						strcpy( buff, orders );
-						trap_Cmd_ExecuteText( EXEC_APPEND, va( buff, uiInfo.teamNames[i] ) );
+						Com_sprintf( buff, sizeof( buff ), orders, uiInfo.teamClientNums[i] );
+						trap_Cmd_ExecuteText( EXEC_APPEND, buff );
 						trap_Cmd_ExecuteText( EXEC_APPEND, "\n" );
 					}
 				}
@@ -4933,8 +4933,8 @@ static void UI_RunMenuScript( char **args ) {
 			if ( String_Parse( args, &orders ) ) {
 				int selectedPlayer = trap_Cvar_VariableValue( "cg_selectedPlayer" );
 				if ( selectedPlayer < uiInfo.myTeamCount ) {
-					strcpy( buff, orders );
-					trap_Cmd_ExecuteText( EXEC_APPEND, va( buff, uiInfo.teamClientNums[selectedPlayer] ) );
+					Com_sprintf( buff, sizeof( buff ), orders, uiInfo.teamClientNums[selectedPlayer] );
+					trap_Cmd_ExecuteText( EXEC_APPEND, buff );
 					trap_Cmd_ExecuteText( EXEC_APPEND, "\n" );
 				}
 				trap_Key_SetCatcher( trap_Key_GetCatcher() & ~KEYCATCH_UI );
@@ -7141,7 +7141,7 @@ void UI_DrawConnectScreen( qboolean overlay ) {
 	if ( !Q_stricmp( cstate.servername,"localhost" ) ) {
 //		Text_PaintCenter(centerPoint, yStart + 48, UI_FONT_DEFAULT, scale, colorWhite, va("Get Psyched!"), ITEM_TEXTSTYLE_SHADOWEDMORE);
 	} else {
-		strcpy( text, va( "Connecting to %s", cstate.servername ) );
+		Com_sprintf(text, sizeof(text), "Connecting to %s", cstate.servername);
 		Text_PaintCenter( centerPoint, yStart + 48, UI_FONT_DEFAULT, scale, colorWhite,text, ITEM_TEXTSTYLE_SHADOWEDMORE );
 	}
 
diff --git a/SP/code/ui/ui_players.c b/SP/code/ui/ui_players.c
index 5ea653a..9618522 100644
--- a/SP/code/ui/ui_players.c
+++ b/SP/code/ui/ui_players.c
@@ -95,9 +95,8 @@ tryagain:
 		goto tryagain;
 	}
 
-	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 ) {
@@ -1398,7 +1397,7 @@ qboolean UI_RegisterClientModelname( playerInfo_t *pi, const char *modelSkinName
 			}
 		}
 
-		strcpy( skinName, va( "%s%s1", team, playerClass ) );
+		Com_sprintf( skinName, sizeof(skinName), "%s%s1", team, playerClass );
 	}
 	// -NERVE - SMF
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/iortcw.git



More information about the Pkg-games-commits mailing list