- use snprintf in condError.

While sprintf is generally problematic, it is particularly dangerous here where it is impossible to estimate the length of the messages.
This commit is contained in:
Christoph Oelckers 2021-07-25 11:50:23 +02:00
parent 9fad44bab2
commit b23db149e3

View file

@ -3247,10 +3247,10 @@ void condError(XSPRITE* pXCond, const char* pzFormat, ...) {
break; break;
} }
sprintf(buffer, "\n\n%s CONDITION RX: %d, TX: %d, SPRITE: #%d RETURNS:\n", condType.GetChars(), pXCond->rxID, pXCond->txID, pXCond->reference); snprintf(buffer, 512, "\n\n%s CONDITION RX: %d, TX: %d, SPRITE: #%d RETURNS:\n", condType.GetChars(), pXCond->rxID, pXCond->txID, pXCond->reference);
va_list args; va_list args;
va_start(args, pzFormat); va_start(args, pzFormat);
vsprintf(buffer2, pzFormat, args); vsnprintf(buffer2, 512, pzFormat, args);
I_Error("%s%s", buffer, buffer2); I_Error("%s%s", buffer, buffer2);
} }