From 2489c8a5e8823747653247bda522b1078e03046a Mon Sep 17 00:00:00 2001 From: James Addison Date: Sat, 17 Dec 2022 23:23:01 +0000 Subject: [PATCH] Update sources to compile successfully with -Wformat-security compilation flag enabled --- cm/CollisionModel_debug.cpp | 2 +- d3xp/Game_local.cpp | 2 +- d3xp/MultiplayerGame.cpp | 66 ++++++++++++++++----------------- d3xp/gamesys/SysCmds.cpp | 4 +- d3xp/script/Script_Thread.cpp | 4 +- framework/Common.cpp | 2 +- framework/Console.cpp | 2 +- framework/DeclManager.cpp | 2 +- framework/EditField.cpp | 2 +- framework/File.cpp | 18 ++++----- framework/FileSystem.cpp | 4 +- framework/async/AsyncServer.cpp | 4 +- idlib/Parser.cpp | 4 +- ui/ListGUI.cpp | 2 +- 14 files changed, 59 insertions(+), 59 deletions(-) diff --git a/cm/CollisionModel_debug.cpp b/cm/CollisionModel_debug.cpp index c37c309..b119a58 100644 --- a/cm/CollisionModel_debug.cpp +++ b/cm/CollisionModel_debug.cpp @@ -137,7 +137,7 @@ const char *idCollisionModelManagerLocal::StringFromContents( const int contents if ( length != 0 ) { length += idStr::snPrintf( contentsString + length, sizeof( contentsString ) - length, "," ); } - length += idStr::snPrintf( contentsString + length, sizeof( contentsString ) - length, cm_contentsNameByIndex[i] ); + length += idStr::snPrintf( contentsString + length, sizeof( contentsString ) - length, "%s", cm_contentsNameByIndex[i] ); } } diff --git a/d3xp/Game_local.cpp b/d3xp/Game_local.cpp index e23eb57..1669ba9 100644 --- a/d3xp/Game_local.cpp +++ b/d3xp/Game_local.cpp @@ -1526,7 +1526,7 @@ bool idGameLocal::NextMap( void ) { int i; if ( !g_mapCycle.GetString()[0] ) { - Printf( common->GetLanguageDict()->GetString( "#str_04294" ) ); + Printf( "%s", common->GetLanguageDict()->GetString( "#str_04294" ) ); return false; } if ( fileSystem->ReadFile( g_mapCycle.GetString(), NULL, NULL ) < 0 ) { diff --git a/d3xp/MultiplayerGame.cpp b/d3xp/MultiplayerGame.cpp index 882418e..dc44c99 100644 --- a/d3xp/MultiplayerGame.cpp +++ b/d3xp/MultiplayerGame.cpp @@ -2823,60 +2823,60 @@ void idMultiplayerGame::PrintMessageEvent( int to, msg_evt_t evt, int parm1, int switch ( evt ) { case MSG_SUICIDE: assert( parm1 >= 0 ); - AddChatLine( common->GetLanguageDict()->GetString( "#str_04293" ), gameLocal.userInfo[ parm1 ].GetString( "ui_name" ) ); + AddChatLine( "%s", common->GetLanguageDict()->GetString( "#str_04293" ), gameLocal.userInfo[ parm1 ].GetString( "ui_name" ) ); break; case MSG_KILLED: assert( parm1 >= 0 && parm2 >= 0 ); - AddChatLine( common->GetLanguageDict()->GetString( "#str_04292" ), gameLocal.userInfo[ parm1 ].GetString( "ui_name" ), gameLocal.userInfo[ parm2 ].GetString( "ui_name" ) ); + AddChatLine( "%s", common->GetLanguageDict()->GetString( "#str_04292" ), gameLocal.userInfo[ parm1 ].GetString( "ui_name" ), gameLocal.userInfo[ parm2 ].GetString( "ui_name" ) ); break; case MSG_KILLEDTEAM: assert( parm1 >= 0 && parm2 >= 0 ); - AddChatLine( common->GetLanguageDict()->GetString( "#str_04291" ), gameLocal.userInfo[ parm1 ].GetString( "ui_name" ), gameLocal.userInfo[ parm2 ].GetString( "ui_name" ) ); + AddChatLine( "%s", common->GetLanguageDict()->GetString( "#str_04291" ), gameLocal.userInfo[ parm1 ].GetString( "ui_name" ), gameLocal.userInfo[ parm2 ].GetString( "ui_name" ) ); break; case MSG_TELEFRAGGED: assert( parm1 >= 0 && parm2 >= 0 ); - AddChatLine( common->GetLanguageDict()->GetString( "#str_04290" ), gameLocal.userInfo[ parm1 ].GetString( "ui_name" ), gameLocal.userInfo[ parm2 ].GetString( "ui_name" ) ); + AddChatLine( "%s", common->GetLanguageDict()->GetString( "#str_04290" ), gameLocal.userInfo[ parm1 ].GetString( "ui_name" ), gameLocal.userInfo[ parm2 ].GetString( "ui_name" ) ); break; case MSG_DIED: assert( parm1 >= 0 ); - AddChatLine( common->GetLanguageDict()->GetString( "#str_04289" ), gameLocal.userInfo[ parm1 ].GetString( "ui_name" ) ); + AddChatLine( "%s", common->GetLanguageDict()->GetString( "#str_04289" ), gameLocal.userInfo[ parm1 ].GetString( "ui_name" ) ); break; case MSG_VOTE: - AddChatLine( common->GetLanguageDict()->GetString( "#str_04288" ) ); + AddChatLine( "%s", common->GetLanguageDict()->GetString( "#str_04288" ) ); break; case MSG_SUDDENDEATH: - AddChatLine( common->GetLanguageDict()->GetString( "#str_04287" ) ); + AddChatLine( "%s", common->GetLanguageDict()->GetString( "#str_04287" ) ); break; case MSG_FORCEREADY: - AddChatLine( common->GetLanguageDict()->GetString( "#str_04286" ), gameLocal.userInfo[ parm1 ].GetString( "ui_name" ) ); + AddChatLine( "%s", common->GetLanguageDict()->GetString( "#str_04286" ), gameLocal.userInfo[ parm1 ].GetString( "ui_name" ) ); if ( gameLocal.entities[ parm1 ] && gameLocal.entities[ parm1 ]->IsType( idPlayer::Type ) ) { static_cast< idPlayer * >( gameLocal.entities[ parm1 ] )->forcedReady = true; } break; case MSG_JOINEDSPEC: - AddChatLine( common->GetLanguageDict()->GetString( "#str_04285" ), gameLocal.userInfo[ parm1 ].GetString( "ui_name" ) ); + AddChatLine( "%s", common->GetLanguageDict()->GetString( "#str_04285" ), gameLocal.userInfo[ parm1 ].GetString( "ui_name" ) ); break; case MSG_TIMELIMIT: - AddChatLine( common->GetLanguageDict()->GetString( "#str_04284" ) ); + AddChatLine( "%s", common->GetLanguageDict()->GetString( "#str_04284" ) ); break; case MSG_FRAGLIMIT: if ( gameLocal.gameType == GAME_LASTMAN ) { - AddChatLine( common->GetLanguageDict()->GetString( "#str_04283" ), gameLocal.userInfo[ parm1 ].GetString( "ui_name" ) ); + AddChatLine( "%s", common->GetLanguageDict()->GetString( "#str_04283" ), gameLocal.userInfo[ parm1 ].GetString( "ui_name" ) ); } else if ( IsGametypeTeamBased() ) { /* CTF */ - AddChatLine( common->GetLanguageDict()->GetString( "#str_04282" ), gameLocal.userInfo[ parm1 ].GetString( "ui_team" ) ); + AddChatLine( "%s", common->GetLanguageDict()->GetString( "#str_04282" ), gameLocal.userInfo[ parm1 ].GetString( "ui_team" ) ); } else { - AddChatLine( common->GetLanguageDict()->GetString( "#str_04281" ), gameLocal.userInfo[ parm1 ].GetString( "ui_name" ) ); + AddChatLine( "%s", common->GetLanguageDict()->GetString( "#str_04281" ), gameLocal.userInfo[ parm1 ].GetString( "ui_name" ) ); } break; case MSG_JOINTEAM: - AddChatLine( common->GetLanguageDict()->GetString( "#str_04280" ), gameLocal.userInfo[ parm1 ].GetString( "ui_name" ), parm2 ? common->GetLanguageDict()->GetString( "#str_02500" ) : common->GetLanguageDict()->GetString( "#str_02499" ) ); + AddChatLine( "%s", common->GetLanguageDict()->GetString( "#str_04280" ), gameLocal.userInfo[ parm1 ].GetString( "ui_name" ), parm2 ? common->GetLanguageDict()->GetString( "#str_02500" ) : common->GetLanguageDict()->GetString( "#str_02499" ) ); break; case MSG_HOLYSHIT: - AddChatLine( common->GetLanguageDict()->GetString( "#str_06732" ) ); + AddChatLine( "%s", common->GetLanguageDict()->GetString( "#str_06732" ) ); break; #ifdef CTF case MSG_POINTLIMIT: - AddChatLine( common->GetLanguageDict()->GetString( "#str_11100" ), parm1 ? common->GetLanguageDict()->GetString( "#str_11110" ) : common->GetLanguageDict()->GetString( "#str_11111" ) ); + AddChatLine( "%s", common->GetLanguageDict()->GetString( "#str_11100" ), parm1 ? common->GetLanguageDict()->GetString( "#str_11110" ) : common->GetLanguageDict()->GetString( "#str_11111" ) ); break; case MSG_FLAGTAKEN : @@ -2887,9 +2887,9 @@ void idMultiplayerGame::PrintMessageEvent( int to, msg_evt_t evt, int parm1, int break; if ( gameLocal.GetLocalPlayer()->team != parm1 ) { - AddChatLine( common->GetLanguageDict()->GetString( "#str_11101" ), gameLocal.userInfo[ parm2 ].GetString( "ui_name" ) ); // your team + AddChatLine( "%s", common->GetLanguageDict()->GetString( "#str_11101" ), gameLocal.userInfo[ parm2 ].GetString( "ui_name" ) ); // your team } else { - AddChatLine( common->GetLanguageDict()->GetString( "#str_11102" ), gameLocal.userInfo[ parm2 ].GetString( "ui_name" ) ); // enemy + AddChatLine( "%s", common->GetLanguageDict()->GetString( "#str_11102" ), gameLocal.userInfo[ parm2 ].GetString( "ui_name" ) ); // enemy } break; @@ -2898,9 +2898,9 @@ void idMultiplayerGame::PrintMessageEvent( int to, msg_evt_t evt, int parm1, int break; if ( gameLocal.GetLocalPlayer()->team != parm1 ) { - AddChatLine( common->GetLanguageDict()->GetString( "#str_11103" ) ); // your team + AddChatLine( "%s", common->GetLanguageDict()->GetString( "#str_11103" ) ); // your team } else { - AddChatLine( common->GetLanguageDict()->GetString( "#str_11104" ) ); // enemy + AddChatLine( "%s", common->GetLanguageDict()->GetString( "#str_11104" ) ); // enemy } break; @@ -2910,12 +2910,12 @@ void idMultiplayerGame::PrintMessageEvent( int to, msg_evt_t evt, int parm1, int if ( parm2 >= 0 && parm2 < MAX_CLIENTS ) { if ( gameLocal.GetLocalPlayer()->team != parm1 ) { - AddChatLine( common->GetLanguageDict()->GetString( "#str_11120" ), gameLocal.userInfo[ parm2 ].GetString( "ui_name" ) ); // your team + AddChatLine( "%s", common->GetLanguageDict()->GetString( "#str_11120" ), gameLocal.userInfo[ parm2 ].GetString( "ui_name" ) ); // your team } else { - AddChatLine( common->GetLanguageDict()->GetString( "#str_11121" ), gameLocal.userInfo[ parm2 ].GetString( "ui_name" ) ); // enemy + AddChatLine( "%s", common->GetLanguageDict()->GetString( "#str_11121" ), gameLocal.userInfo[ parm2 ].GetString( "ui_name" ) ); // enemy } } else { - AddChatLine( common->GetLanguageDict()->GetString( "#str_11105" ), parm1 ? common->GetLanguageDict()->GetString( "#str_11110" ) : common->GetLanguageDict()->GetString( "#str_11111" ) ); + AddChatLine( "%s", common->GetLanguageDict()->GetString( "#str_11105" ), parm1 ? common->GetLanguageDict()->GetString( "#str_11110" ) : common->GetLanguageDict()->GetString( "#str_11111" ) ); } break; @@ -2927,16 +2927,16 @@ void idMultiplayerGame::PrintMessageEvent( int to, msg_evt_t evt, int parm1, int break; if ( gameLocal.GetLocalPlayer()->team != parm1 ) { - AddChatLine( common->GetLanguageDict()->GetString( "#str_11122" ), gameLocal.userInfo[ parm2 ].GetString( "ui_name" ) ); // your team + AddChatLine( "%s", common->GetLanguageDict()->GetString( "#str_11122" ), gameLocal.userInfo[ parm2 ].GetString( "ui_name" ) ); // your team } else { - AddChatLine( common->GetLanguageDict()->GetString( "#str_11123" ), gameLocal.userInfo[ parm2 ].GetString( "ui_name" ) ); // enemy + AddChatLine( "%s", common->GetLanguageDict()->GetString( "#str_11123" ), gameLocal.userInfo[ parm2 ].GetString( "ui_name" ) ); // enemy } -// AddChatLine( common->GetLanguageDict()->GetString( "#str_11106" ), parm1 ? common->GetLanguageDict()->GetString( "#str_11110" ) : common->GetLanguageDict()->GetString( "#str_11111" ) ); +// AddChatLine( "%s", common->GetLanguageDict()->GetString( "#str_11106" ), parm1 ? common->GetLanguageDict()->GetString( "#str_11110" ) : common->GetLanguageDict()->GetString( "#str_11111" ) ); break; case MSG_SCOREUPDATE: - AddChatLine( common->GetLanguageDict()->GetString( "#str_11107" ), parm1, parm2 ); + AddChatLine( "%s", common->GetLanguageDict()->GetString( "#str_11107" ), parm1, parm2 ); break; #endif default: @@ -3257,7 +3257,7 @@ void idMultiplayerGame::ClientStartVote( int clientNum, const char *_voteString } voteString = _voteString; - AddChatLine( va( common->GetLanguageDict()->GetString( "#str_04279" ), gameLocal.userInfo[ clientNum ].GetString( "ui_name" ) ) ); + AddChatLine( "%s", va( common->GetLanguageDict()->GetString( "#str_04279" ), gameLocal.userInfo[ clientNum ].GetString( "ui_name" ) ) ); gameSoundWorld->PlayShaderDirectly( GlobalSoundStrings[ SND_VOTE ] ); if ( clientNum == gameLocal.localClientNum ) { voted = true; @@ -3297,14 +3297,14 @@ void idMultiplayerGame::ClientUpdateVote( vote_result_t status, int yesCount, in switch ( status ) { case VOTE_FAILED: - AddChatLine( common->GetLanguageDict()->GetString( "#str_04278" ) ); + AddChatLine( "%s", common->GetLanguageDict()->GetString( "#str_04278" ) ); gameSoundWorld->PlayShaderDirectly( GlobalSoundStrings[ SND_VOTE_FAILED ] ); if ( gameLocal.isClient ) { vote = VOTE_NONE; } break; case VOTE_PASSED: - AddChatLine( common->GetLanguageDict()->GetString( "#str_04277" ) ); + AddChatLine( "%s", common->GetLanguageDict()->GetString( "#str_04277" ) ); gameSoundWorld->PlayShaderDirectly( GlobalSoundStrings[ SND_VOTE_PASSED ] ); break; case VOTE_RESET: @@ -3313,7 +3313,7 @@ void idMultiplayerGame::ClientUpdateVote( vote_result_t status, int yesCount, in } break; case VOTE_ABORTED: - AddChatLine( common->GetLanguageDict()->GetString( "#str_04276" ) ); + AddChatLine( "%s", common->GetLanguageDict()->GetString( "#str_04276" ) ); if ( gameLocal.isClient ) { vote = VOTE_NONE; } @@ -3851,7 +3851,7 @@ void idMultiplayerGame::ToggleSpectate( void ) { if ( gameLocal.serverInfo.GetBool( "si_spectators" ) ) { cvarSystem->SetCVarString( "ui_spectate", "Spectate" ); } else { - gameLocal.mpGame.AddChatLine( common->GetLanguageDict()->GetString( "#str_06747" ) ); + gameLocal.mpGame.AddChatLine( "%s", common->GetLanguageDict()->GetString( "#str_06747" ) ); } } } @@ -3905,7 +3905,7 @@ void idMultiplayerGame::ThrottleUserInfo( void ) { if ( idStr::Icmp( gameLocal.userInfo[ gameLocal.localClientNum ].GetString( ThrottleVars[ i ] ), cvarSystem->GetCVarString( ThrottleVars[ i ] ) ) ) { if ( gameLocal.realClientTime < switchThrottle[ i ] ) { - AddChatLine( common->GetLanguageDict()->GetString( "#str_04299" ), common->GetLanguageDict()->GetString( ThrottleVarsInEnglish[ i ] ), ( switchThrottle[ i ] - gameLocal.time ) / 1000 + 1 ); + AddChatLine( "%s", common->GetLanguageDict()->GetString( "#str_04299" ), common->GetLanguageDict()->GetString( ThrottleVarsInEnglish[ i ] ), ( switchThrottle[ i ] - gameLocal.time ) / 1000 + 1 ); cvarSystem->SetCVarString( ThrottleVars[ i ], gameLocal.userInfo[ gameLocal.localClientNum ].GetString( ThrottleVars[ i ] ) ); } else { switchThrottle[ i ] = gameLocal.time + ThrottleDelay[ i ] * 1000; diff --git a/d3xp/gamesys/SysCmds.cpp b/d3xp/gamesys/SysCmds.cpp index a480a92..dbec850 100644 --- a/d3xp/gamesys/SysCmds.cpp +++ b/d3xp/gamesys/SysCmds.cpp @@ -714,7 +714,7 @@ Cmd_AddChatLine_f ================== */ static void Cmd_AddChatLine_f( const idCmdArgs &args ) { - gameLocal.mpGame.AddChatLine( args.Argv( 1 ) ); + gameLocal.mpGame.AddChatLine( "%s", args.Argv( 1 ) ); } /* @@ -1316,7 +1316,7 @@ static void PrintFloat( float f ) { buf[i] = ' '; } buf[i] = '\0'; - gameLocal.Printf( buf ); + gameLocal.Printf( "%s", buf ); } /* diff --git a/d3xp/script/Script_Thread.cpp b/d3xp/script/Script_Thread.cpp index a17eee8..3e44062 100644 --- a/d3xp/script/Script_Thread.cpp +++ b/d3xp/script/Script_Thread.cpp @@ -885,7 +885,7 @@ void idThread::Error( const char *fmt, ... ) const { vsprintf( text, fmt, argptr ); va_end( argptr ); - interpreter.Error( text ); + interpreter.Error( "%s", text ); } /* @@ -901,7 +901,7 @@ void idThread::Warning( const char *fmt, ... ) const { vsprintf( text, fmt, argptr ); va_end( argptr ); - interpreter.Warning( text ); + interpreter.Warning( "%s", text ); } /* diff --git a/framework/Common.cpp b/framework/Common.cpp index e3fb55f..1203abd 100644 --- a/framework/Common.cpp +++ b/framework/Common.cpp @@ -2523,7 +2523,7 @@ void idCommonLocal::Frame( void ) { // the FPU stack better be empty at this point or some bad code or compiler bug left values on the stack if ( !Sys_FPU_StackIsEmpty() ) { - Printf( Sys_FPU_GetState() ); + Printf( "%s", Sys_FPU_GetState() ); FatalError( "idCommon::Frame: the FPU stack is not empty at the end of the frame\n" ); } } diff --git a/framework/Console.cpp b/framework/Console.cpp index af2d5d9..9f2e3a6 100644 --- a/framework/Console.cpp +++ b/framework/Console.cpp @@ -266,7 +266,7 @@ float SCR_DrawAsyncStats( float y ) { idStr msg; idAsyncNetwork::server.GetAsyncStatsAvgMsg( msg ); - SCR_DrawTextRightAlign( y, msg.c_str() ); + SCR_DrawTextRightAlign( y, "%s", msg.c_str() ); } else if ( idAsyncNetwork::client.IsActive() ) { diff --git a/framework/DeclManager.cpp b/framework/DeclManager.cpp index ed3252c..7603e63 100644 --- a/framework/DeclManager.cpp +++ b/framework/DeclManager.cpp @@ -1028,7 +1028,7 @@ void idDeclManagerLocal::LoadManual( ) pageB = 0; } - f->Printf( va("skin manualpage_%d_%d\n{\nmodels/weapon_map/page_%d %s\nmodels/weapon_map/page_%d %s\n}\n\n", + f->Printf( "%s", va("skin manualpage_%d_%d\n{\nmodels/weapon_map/page_%d %s\nmodels/weapon_map/page_%d %s\n}\n\n", i, i+1, pageA, imageNames[i].c_str(), pageB, imageNames[i+1].c_str() )); diff --git a/framework/EditField.cpp b/framework/EditField.cpp index 57394e9..ce6f286 100644 --- a/framework/EditField.cpp +++ b/framework/EditField.cpp @@ -282,7 +282,7 @@ void idEditField::AutoComplete( void ) { autoComplete = globalAutoComplete; // and print it - idStr::snPrintf( buffer, sizeof( buffer ), autoComplete.currentMatch ); + idStr::snPrintf( buffer, sizeof( buffer ), "%s", autoComplete.currentMatch ); if ( autoComplete.length > (int)strlen( buffer ) ) { autoComplete.length = strlen( buffer ); } diff --git a/framework/File.cpp b/framework/File.cpp index 199eb13..e0da937 100644 --- a/framework/File.cpp +++ b/framework/File.cpp @@ -73,40 +73,40 @@ int FS_WriteFloatString( char *buf, const char *fmt, va_list argPtr ) { index += sprintf( buf+index, "%s", tmp.c_str() ); } else { - index += sprintf( buf+index, format.c_str(), f ); + index += sprintf( buf+index, "%s", format.c_str(), f ); } break; case 'd': case 'i': i = va_arg( argPtr, int ); - index += sprintf( buf+index, format.c_str(), i ); + index += sprintf( buf+index, "%s", format.c_str(), i ); break; case 'u': u = va_arg( argPtr, unsigned int ); - index += sprintf( buf+index, format.c_str(), u ); + index += sprintf( buf+index, "%s", format.c_str(), u ); break; case 'o': u = va_arg( argPtr, unsigned int ); - index += sprintf( buf+index, format.c_str(), u ); + index += sprintf( buf+index, "%s", format.c_str(), u ); break; case 'x': u = va_arg( argPtr, unsigned int ); - index += sprintf( buf+index, format.c_str(), u ); + index += sprintf( buf+index, "%s", format.c_str(), u ); break; case 'X': u = va_arg( argPtr, unsigned int ); - index += sprintf( buf+index, format.c_str(), u ); + index += sprintf( buf+index, "%s", format.c_str(), u ); break; case 'c': i = va_arg( argPtr, int ); - index += sprintf( buf+index, format.c_str(), (char) i ); + index += sprintf( buf+index, "%s", format.c_str(), (char) i ); break; case 's': str = va_arg( argPtr, char * ); - index += sprintf( buf+index, format.c_str(), str ); + index += sprintf( buf+index, "%s", format.c_str(), str ); break; case '%': - index += sprintf( buf+index, format.c_str() ); + index += sprintf( buf+index, "%s", format.c_str() ); break; default: common->Error( "FS_WriteFloatString: invalid format %s", format.c_str() ); diff --git a/framework/FileSystem.cpp b/framework/FileSystem.cpp index 34b0bd8..a34abcb 100644 --- a/framework/FileSystem.cpp +++ b/framework/FileSystem.cpp @@ -3991,7 +3991,7 @@ void idFileSystemLocal::FindDLL( const char *name, char _dllPath[ MAX_OSPATH ], } else { dllPath = ""; } - idStr::snPrintf( _dllPath, MAX_OSPATH, dllPath.c_str() ); + idStr::snPrintf( _dllPath, MAX_OSPATH, "%s", dllPath.c_str() ); } /* @@ -4270,4 +4270,4 @@ idStr idFileSystemLocal::GetModDescription(idStr descPath) } return desc; -} \ No newline at end of file +} diff --git a/framework/async/AsyncServer.cpp b/framework/async/AsyncServer.cpp index 45e99cc..159e528 100644 --- a/framework/async/AsyncServer.cpp +++ b/framework/async/AsyncServer.cpp @@ -1456,7 +1456,7 @@ void idAsyncServer::ProcessAuthMessage( const idBitMsg &msg ) { return; } - idStr::snPrintf( challenges[ i ].guid, 12, client_guid ); + idStr::snPrintf( challenges[ i ].guid, 12, "%s", client_guid ); if ( reply == AUTH_OK ) { challenges[ i ].authState = CDK_OK; common->Printf( "client %s %s is authed\n", Sys_NetAdrToString( client_from ), client_guid ); @@ -1743,7 +1743,7 @@ void idAsyncServer::ProcessConnectMessage( const netadr_t from, const idBitMsg & PrintOOB( from, SERVER_PRINT_MISC, msg ); // update the guid in the challenges - idStr::snPrintf( challenges[ ichallenge ].guid, sizeof( challenges[ ichallenge ].guid ), guid ); + idStr::snPrintf( challenges[ ichallenge ].guid, sizeof( challenges[ ichallenge ].guid ), "%s", guid ); // once auth replied denied, stop sending further requests if ( challenges[ ichallenge ].authReply != AUTH_DENY ) { diff --git a/idlib/Parser.cpp b/idlib/Parser.cpp index d2b95b3..4cebd4b 100644 --- a/idlib/Parser.cpp +++ b/idlib/Parser.cpp @@ -323,7 +323,7 @@ void idParser::Error( const char *str, ... ) const { vsprintf(text, str, ap); va_end(ap); if ( idParser::scriptstack ) { - idParser::scriptstack->Error( text ); + idParser::scriptstack->Error( "%s", text ); } } @@ -340,7 +340,7 @@ void idParser::Warning( const char *str, ... ) const { vsprintf(text, str, ap); va_end(ap); if ( idParser::scriptstack ) { - idParser::scriptstack->Warning( text ); + idParser::scriptstack->Warning( "%s", text ); } } diff --git a/ui/ListGUI.cpp b/ui/ListGUI.cpp index 8825b72..530fb1b 100644 --- a/ui/ListGUI.cpp +++ b/ui/ListGUI.cpp @@ -76,7 +76,7 @@ int idListGUILocal::GetSelection( char *s, int size, int _sel ) const { return -1; } if ( s ) { - idStr::snPrintf( s, size, m_pGUI->State().GetString( va( "%s_item_%i", m_name.c_str(), sel ), "" ) ); + idStr::snPrintf( s, size, "%s", m_pGUI->State().GetString( va( "%s_item_%i", m_name.c_str(), sel ), "" ) ); } // don't let overflow if ( sel >= m_ids.Num() ) {