game: fix string vulnerabilities

This commit is contained in:
SanyaSho
2022-11-04 01:28:39 +00:00
parent ba90de20d9
commit e368f3e9a6
7 changed files with 23 additions and 23 deletions
+3 -3
View File
@@ -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
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()
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;
}