diff --git a/code/ui/ui_main.c b/code/ui/ui_main.c index 50b708ab..f5574e12 100644 --- a/code/ui/ui_main.c +++ b/code/ui/ui_main.c @@ -971,7 +971,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/menus.txt"; @@ -1280,8 +1280,8 @@ static void UI_DrawPlayerModel(rectDef_t *rect) { vec3_t moveangles; if (trap_Cvar_VariableValue("ui_Q3Model")) { - strcpy(model, UI_Cvar_VariableString("model")); - strcpy(head, UI_Cvar_VariableString("headmodel")); + Q_strncpyz(model, UI_Cvar_VariableString("model"), sizeof(model)); + Q_strncpyz(head, UI_Cvar_VariableString("headmodel"), sizeof(head)); if (!q3Model) { q3Model = qtrue; updateModel = qtrue; @@ -1289,9 +1289,9 @@ static void UI_DrawPlayerModel(rectDef_t *rect) { team[0] = '\0'; } else { - strcpy(team, UI_Cvar_VariableString("ui_teamName")); - strcpy(model, UI_Cvar_VariableString("team_model")); - strcpy(head, UI_Cvar_VariableString("team_headmodel")); + Q_strncpyz(team, UI_Cvar_VariableString("ui_teamName"), sizeof(team)); + Q_strncpyz(model, UI_Cvar_VariableString("team_model"), sizeof(model)); + Q_strncpyz(head, UI_Cvar_VariableString("team_headmodel"), sizeof(head)); if (q3Model) { q3Model = qfalse; updateModel = qtrue; @@ -1490,8 +1490,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)); team[0] = '\0'; memset( &info2, 0, sizeof(playerInfo_t) ); @@ -3508,8 +3508,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" ); } else { int i; @@ -3517,8 +3517,8 @@ static void UI_RunMenuScript(char **args) { if (Q_stricmp(UI_Cvar_VariableString("name"), uiInfo.teamNames[i]) == 0) { continue; } - strcpy(buff, orders); - trap_Cmd_ExecuteText( EXEC_APPEND, va(buff, uiInfo.teamNames[i]) ); + Com_sprintf( buff, sizeof( buff ), orders, uiInfo.teamNames[i] ); + trap_Cmd_ExecuteText( EXEC_APPEND, buff ); trap_Cmd_ExecuteText( EXEC_APPEND, "\n" ); } } @@ -3545,8 +3545,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 ); @@ -5554,7 +5554,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("Connecting to %s", cstate.servername)); + Com_sprintf(text, sizeof(text), "Connecting to %s", cstate.servername); Text_PaintCenter(centerPoint, yStart + 48, scale, colorWhite,text , ITEM_TEXTSTYLE_SHADOWEDMORE); }