Browse Source

More safe _snprintf usage.

fix-cwd-path
Andrey Akhmichin 2 years ago
parent
commit
7cffbef773
No known key found for this signature in database
GPG Key ID: 1F180D249B0643C0
  1. 4
      cl_dll/vgui_TeamFortressViewport.cpp
  2. 7
      cl_dll/voice_status.cpp

4
cl_dll/vgui_TeamFortressViewport.cpp

@ -1309,9 +1309,9 @@ void TeamFortressViewport::UpdateSpectatorPanel()
if( timer < 0 ) if( timer < 0 )
timer = 0; timer = 0;
_snprintf( szText, 63, "%d:%02d\n", ( timer / 60 ), ( timer % 60 ) ); _snprintf( szText, sizeof(szText) - 1, "%d:%02d\n", ( timer / 60 ), ( timer % 60 ) );
szText[63] = 0; szText[sizeof(szText) - 1] = '\0';
m_pSpectatorPanel->m_CurrentTime->setText( szText ); */ m_pSpectatorPanel->m_CurrentTime->setText( szText ); */

7
cl_dll/voice_status.cpp

@ -391,7 +391,7 @@ void CVoiceStatus::UpdateSpeakerStatus( int entindex, qboolean bTalking )
if ( gEngfuncs.pfnGetCvarFloat( "voice_clientdebug" ) ) if ( gEngfuncs.pfnGetCvarFloat( "voice_clientdebug" ) )
{ {
char msg[256]; char msg[256];
_snprintf( msg, sizeof( msg ), "CVoiceStatus::UpdateSpeakerStatus: ent %d talking = %d\n", entindex, bTalking ); sprintf( msg, "CVoiceStatus::UpdateSpeakerStatus: ent %d talking = %d\n", entindex, bTalking );
gEngfuncs.pfnConsolePrint( msg ); gEngfuncs.pfnConsolePrint( msg );
} }
@ -446,7 +446,8 @@ void CVoiceStatus::UpdateSpeakerStatus( int entindex, qboolean bTalking )
gEngfuncs.pfnGetPlayerInfo( entindex, &info ); gEngfuncs.pfnGetPlayerInfo( entindex, &info );
char paddedName[512]; char paddedName[512];
_snprintf( paddedName, sizeof( paddedName ), "%s ", info.name ); _snprintf( paddedName, sizeof( paddedName ) - 1, "%s ", info.name );
paddedName[sizeof(paddedName) - 1] = '\0';
int color[3]; int color[3];
m_pHelper->GetPlayerTextColor( entindex, color ); m_pHelper->GetPlayerTextColor( entindex, color );
@ -507,7 +508,7 @@ void CVoiceStatus::UpdateServerState(bool bForce)
m_bServerModEnable = bCVarModEnable; m_bServerModEnable = bCVarModEnable;
char str[256]; char str[256];
_snprintf(str, sizeof(str), "VModEnable %d", m_bServerModEnable); sprintf(str, "VModEnable %d", m_bServerModEnable);
ServerCmd(str); ServerCmd(str);
if(gEngfuncs.pfnGetCvarFloat("voice_clientdebug")) if(gEngfuncs.pfnGetCvarFloat("voice_clientdebug"))

Loading…
Cancel
Save