Fix format string vulnerabilities

This commit is contained in:
samisalreadytaken 2021-10-23 18:45:05 +03:00
parent 5fa7648693
commit b2c0ab41c0
2 changed files with 4 additions and 4 deletions

View File

@ -129,7 +129,7 @@ void CDebugOverlay::Paint()
{ {
float xPos = screenPos[0]; float xPos = screenPos[0];
float yPos = screenPos[1]+ (pCurrText->lineOffset*13); // Line spacing; float yPos = screenPos[1]+ (pCurrText->lineOffset*13); // Line spacing;
g_pMatSystemSurface->DrawColoredText( m_hFont, xPos, yPos, r, g, b, a, pCurrText->text ); g_pMatSystemSurface->DrawColoredText( m_hFont, xPos, yPos, r, g, b, a, "%s", pCurrText->text );
} }
} }
else else
@ -138,7 +138,7 @@ void CDebugOverlay::Paint()
{ {
float xPos = screenPos[0]; float xPos = screenPos[0];
float yPos = screenPos[1]+ (pCurrText->lineOffset*13); // Line spacing; float yPos = screenPos[1]+ (pCurrText->lineOffset*13); // Line spacing;
g_pMatSystemSurface->DrawColoredText( m_hFont, xPos, yPos, r, g, b, a, pCurrText->text ); g_pMatSystemSurface->DrawColoredText( m_hFont, xPos, yPos, r, g, b, a, "%s", pCurrText->text );
} }
} }
} }

View File

@ -908,7 +908,7 @@ bool ScriptIsClient()
// Notification printing on the right edge of the screen // Notification printing on the right edge of the screen
void NPrint( int pos, const char* fmt ) void NPrint( int pos, const char* fmt )
{ {
engine->Con_NPrintf(pos, fmt); engine->Con_NPrintf( pos, "%s", fmt );
} }
void NXPrint( int pos, int r, int g, int b, bool fixed, float ftime, const char* fmt ) void NXPrint( int pos, int r, int g, int b, bool fixed, float ftime, const char* fmt )
@ -922,7 +922,7 @@ void NXPrint( int pos, int r, int g, int b, bool fixed, float ftime, const char*
info.color[2] = b / 255.f; info.color[2] = b / 255.f;
info.fixed_width_font = fixed; info.fixed_width_font = fixed;
engine->Con_NXPrintf( &info, fmt ); engine->Con_NXPrintf( &info, "%s", fmt );
} }
static float IntervalPerTick() static float IntervalPerTick()