Browse Source

Merge pull request #133 from SanyaSho/master

string vulnerabilities
pull/142/head
nillerusr 2 years ago committed by GitHub
parent
commit
cb0e405e0f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      game/client/message.cpp
  2. 6
      game/client/vgui_messagechars.cpp
  3. 24
      game/client/vgui_netgraphpanel.cpp
  4. 2
      game/client/vgui_textmessagepanel.cpp
  5. 6
      game/server/ai_speech.cpp
  6. 2
      game/server/util.cpp
  7. 2
      vgui2/dme_controls/dmedagrenderpanel.cpp

4
game/client/message.cpp

@ -987,7 +987,7 @@ void CHudMessage::AddChar( int r, int g, int b, int a, wchar_t ch ) @@ -987,7 +987,7 @@ void CHudMessage::AddChar( int r, int g, int b, int a, wchar_t ch )
//-----------------------------------------------------------------------------
void CHudMessage::GetTextExtents( int *wide, int *tall, const char *string )
{
*wide = g_pMatSystemSurface->DrawTextLen( m_hFont, (char *)string );
*wide = g_pMatSystemSurface->DrawTextLen( m_hFont, "%s", (char *)string );
*tall = vgui::surface()->GetFontTall( m_hFont );
}
@ -1067,4 +1067,4 @@ void CHudMessage::PaintCharacters() @@ -1067,4 +1067,4 @@ void CHudMessage::PaintCharacters()
void CHudMessage::GetLength( int *wide, int *tall, const char *string )
{
GetTextExtents( wide, tall, string );
}
}

6
game/client/vgui_messagechars.cpp

@ -252,7 +252,7 @@ int CMessageCharsPanel::AddText( @@ -252,7 +252,7 @@ int CMessageCharsPanel::AddText(
msg->hCustomFont = m_hFont;
// Return new cursor position
return x + g_pMatSystemSurface->DrawTextLen( msg->hCustomFont, data );
return x + g_pMatSystemSurface->DrawTextLen( msg->hCustomFont, "%s", data );
}
//-----------------------------------------------------------------------------
@ -272,7 +272,7 @@ void CMessageCharsPanel::GetTextExtents( vgui::HFont hCustomFont, int *wide, int @@ -272,7 +272,7 @@ void CMessageCharsPanel::GetTextExtents( vgui::HFont hCustomFont, int *wide, int
Assert( hCustomFont );
*wide = g_pMatSystemSurface->DrawTextLen( hCustomFont, (char *)string );
*wide = g_pMatSystemSurface->DrawTextLen( hCustomFont, "%s", (char *)string );
*tall = vgui::surface()->GetFontTall( hCustomFont );
}
@ -310,7 +310,7 @@ void CMessageCharsPanel::Paint() @@ -310,7 +310,7 @@ void CMessageCharsPanel::Paint()
CMessageCharsPanel::message_t *msg = m_pActive;
while ( msg )
{
g_pMatSystemSurface->DrawColoredText( msg->hCustomFont, msg->x, msg->y, msg->r, msg->g, msg->b, msg->a, msg->text );
g_pMatSystemSurface->DrawColoredText( msg->hCustomFont, msg->x, msg->y, msg->r, msg->g, msg->b, msg->a, "%s", msg->text );
msg = msg->next;
}

24
game/client/vgui_netgraphpanel.cpp

@ -733,8 +733,8 @@ void CNetGraphPanel::DrawTextFields( int graphvalue, int x, int y, int w, netban @@ -733,8 +733,8 @@ void CNetGraphPanel::DrawTextFields( int graphvalue, int x, int y, int w, netban
int textTall = surface()->GetFontTall( font );
Q_snprintf( sz, sizeof( sz ), "fps:%4i ping: %i ms", (int)(1.0f / m_Framerate), (int)(m_AvgLatency*1000.0f) );
g_pMatSystemSurface->DrawColoredText( font, x, y, GRAPH_RED, GRAPH_GREEN, GRAPH_BLUE, 255, sz );
g_pMatSystemSurface->DrawColoredText( font, x, y, GRAPH_RED, GRAPH_GREEN, GRAPH_BLUE, 255, "%s", sz );
// Draw update rate
DrawUpdateRate( x + w, y );
@ -752,12 +752,12 @@ void CNetGraphPanel::DrawTextFields( int graphvalue, int x, int y, int w, netban @@ -752,12 +752,12 @@ void CNetGraphPanel::DrawTextFields( int graphvalue, int x, int y, int w, netban
}
int totalsize = graph[ ( m_IncomingSequence & ( TIMINGS - 1 ) ) ].msgbytes[INetChannelInfo::TOTAL];
Q_snprintf( sz, sizeof( sz ), "in :%4i %2.2f k/s ", totalsize, m_IncomingData );
int textWidth = g_pMatSystemSurface->DrawTextLen( font, "%s", sz );
g_pMatSystemSurface->DrawColoredText( font, x, y, GRAPH_RED, GRAPH_GREEN, GRAPH_BLUE, 255, sz );
g_pMatSystemSurface->DrawColoredText( font, x, y, GRAPH_RED, GRAPH_GREEN, GRAPH_BLUE, 255, "%s", sz );
Q_snprintf( sz, sizeof( sz ), "lerp: %5.1f ms", GetClientInterpAmount() * 1000.0f );
@ -781,23 +781,23 @@ void CNetGraphPanel::DrawTextFields( int graphvalue, int x, int y, int w, netban @@ -781,23 +781,23 @@ void CNetGraphPanel::DrawTextFields( int graphvalue, int x, int y, int w, netban
}
}
g_pMatSystemSurface->DrawColoredText( font, x + textWidth, y, interpcolor[ 0 ], interpcolor[ 1 ], interpcolor[ 2 ], 255, sz );
g_pMatSystemSurface->DrawColoredText( font, x + textWidth, y, interpcolor[ 0 ], interpcolor[ 1 ], interpcolor[ 2 ], 255, "%s", sz );
Q_snprintf( sz, sizeof( sz ), "%3.1f/s", m_AvgPacketIn );
textWidth = g_pMatSystemSurface->DrawTextLen( font, "%s", sz );
g_pMatSystemSurface->DrawColoredText( font, x + w - textWidth - 1, y, GRAPH_RED, GRAPH_GREEN, GRAPH_BLUE, 255, sz );
g_pMatSystemSurface->DrawColoredText( font, x + w - textWidth - 1, y, GRAPH_RED, GRAPH_GREEN, GRAPH_BLUE, 255, "%s", sz );
y += textTall;
Q_snprintf( sz, sizeof( sz ), "out:%4i %2.2f k/s", out, m_OutgoingData );
g_pMatSystemSurface->DrawColoredText( font, x, y, GRAPH_RED, GRAPH_GREEN, GRAPH_BLUE, 255, sz );
g_pMatSystemSurface->DrawColoredText( font, x, y, GRAPH_RED, GRAPH_GREEN, GRAPH_BLUE, 255, "%s", sz );
Q_snprintf( sz, sizeof( sz ), "%3.1f/s", m_AvgPacketOut );
textWidth = g_pMatSystemSurface->DrawTextLen( font, "%s", sz );
g_pMatSystemSurface->DrawColoredText( font, x + w - textWidth - 1, y, GRAPH_RED, GRAPH_GREEN, GRAPH_BLUE, 255, sz );
g_pMatSystemSurface->DrawColoredText( font, x + w - textWidth - 1, y, GRAPH_RED, GRAPH_GREEN, GRAPH_BLUE, 255, "%s", sz );
y += textTall;
@ -809,7 +809,7 @@ void CNetGraphPanel::DrawTextFields( int graphvalue, int x, int y, int w, netban @@ -809,7 +809,7 @@ void CNetGraphPanel::DrawTextFields( int graphvalue, int x, int y, int w, netban
textWidth = g_pMatSystemSurface->DrawTextLen( font, "%s", sz );
g_pMatSystemSurface->DrawColoredText( font, x, y, GRAPH_RED, GRAPH_GREEN, GRAPH_BLUE, 255, sz );
g_pMatSystemSurface->DrawColoredText( font, x, y, GRAPH_RED, GRAPH_GREEN, GRAPH_BLUE, 255, "%s", sz );
y += textTall;
@ -832,7 +832,7 @@ void CNetGraphPanel::DrawTextFields( int graphvalue, int x, int y, int w, netban @@ -832,7 +832,7 @@ void CNetGraphPanel::DrawTextFields( int graphvalue, int x, int y, int w, netban
servercolor[ 2 ] = 0;
}
g_pMatSystemSurface->DrawColoredText( font, x, y, servercolor[ 0 ], servercolor[ 1 ], servercolor[ 2 ], 255, sz );
g_pMatSystemSurface->DrawColoredText( font, x, y, servercolor[ 0 ], servercolor[ 1 ], servercolor[ 2 ], 255, "%s", sz );
y += textTall;
}
@ -1119,14 +1119,14 @@ void CNetGraphPanel::DrawLargePacketSizes( int x, int w, int graphtype, float wa @@ -1119,14 +1119,14 @@ void CNetGraphPanel::DrawLargePacketSizes( int x, int w, int graphtype, float wa
char sz[ 32 ];
Q_snprintf( sz, sizeof( sz ), "%i", nTotalBytes );
int len = g_pMatSystemSurface->DrawTextLen( m_hFont, sz );
int len = g_pMatSystemSurface->DrawTextLen( m_hFont, "%s", sz );
int textx, texty;
textx = rcFill.x - len / 2;
texty = MAX( 0, rcFill.y - 11 );
g_pMatSystemSurface->DrawColoredText( m_hFont, textx, texty, 255, 255, 255, 255, sz );
g_pMatSystemSurface->DrawColoredText( m_hFont, textx, texty, 255, 255, 255, 255, "%s", sz );
}
}
}

2
game/client/vgui_textmessagepanel.cpp

@ -238,7 +238,7 @@ void CTextMessagePanel::AddChar( int r, int g, int b, int a, wchar_t ch ) @@ -238,7 +238,7 @@ void CTextMessagePanel::AddChar( int r, int g, int b, int a, wchar_t ch )
//-----------------------------------------------------------------------------
void CTextMessagePanel::GetTextExtents( int *wide, int *tall, const char *string )
{
*wide = g_pMatSystemSurface->DrawTextLen( m_hFont, (char *)string );
*wide = g_pMatSystemSurface->DrawTextLen( m_hFont, "%s", (char *)string );
*tall = vgui::surface()->GetFontTall( m_hFont );
}

6
game/server/ai_speech.cpp

@ -885,13 +885,13 @@ void CAI_Expresser::SpeechMsg( CBaseEntity *pFlex, const char *pszFormat, ... ) @@ -885,13 +885,13 @@ void CAI_Expresser::SpeechMsg( CBaseEntity *pFlex, const char *pszFormat, ... )
if ( pFlex->MyNPCPointer() )
{
DevMsg( pFlex->MyNPCPointer(), string );
DevMsg( pFlex->MyNPCPointer(), "%s", string );
}
else
{
DevMsg( "%s", string );
}
UTIL_LogPrintf( string );
UTIL_LogPrintf( "%s", string );
}
@ -1042,4 +1042,4 @@ void CMultiplayer_Expresser::AllowMultipleScenes() @@ -1042,4 +1042,4 @@ void CMultiplayer_Expresser::AllowMultipleScenes()
void CMultiplayer_Expresser::DisallowMultipleScenes()
{
m_bAllowMultipleScenes = false;
}
}

2
game/server/util.cpp

@ -59,7 +59,7 @@ void DBG_AssertFunction( bool fExpr, const char *szExpr, const char *szFile, int @@ -59,7 +59,7 @@ void DBG_AssertFunction( bool fExpr, const char *szExpr, const char *szFile, int
Q_snprintf(szOut,sizeof(szOut), "ASSERT FAILED:\n %s \n(%s@%d)\n%s", szExpr, szFile, szLine, szMessage);
else
Q_snprintf(szOut,sizeof(szOut), "ASSERT FAILED:\n %s \n(%s@%d)\n", szExpr, szFile, szLine);
Warning( szOut);
Warning( "%s", szOut );
}
#endif // DEBUG

2
vgui2/dme_controls/dmedagrenderpanel.cpp

@ -263,7 +263,7 @@ void CDmeDagRenderPanel::DrawJointNames( CDmeDag *pRoot, CDmeDag *pDag, const ma @@ -263,7 +263,7 @@ void CDmeDagRenderPanel::DrawJointNames( CDmeDag *pRoot, CDmeDag *pDag, const ma
{
Q_snprintf( pJointName, sizeof(pJointName), "%s", pJoint->GetName() );
}
g_pMatSystemSurface->DrawColoredText( m_hFont, vecPanelPos.x + 5, vecPanelPos.y, 255, 255, 255, 255, pJointName );
g_pMatSystemSurface->DrawColoredText( m_hFont, vecPanelPos.x + 5, vecPanelPos.y, 255, 255, 255, 255, "%s", pJointName );
}
int nCount = pDag->GetChildCount();

Loading…
Cancel
Save