prevent string placeholders in HUD Messages which may crash the game

This commit is contained in:
zicodxx 2007-04-21 08:27:21 +00:00
parent d568b27777
commit 8541d2d403
2 changed files with 12 additions and 1 deletions

View file

@ -1,5 +1,9 @@
D2X-Rebirth Changelog
20070421
--------
main/hud.c: prevent string placeholders in HUD Messages which may crash the game
20070420
--------
main/laser.c: made smart blobs easier to dodge

View file

@ -253,7 +253,7 @@ int PlayerMessage=1;
// (message might not be drawn if previous message was same)
int HUD_init_message_va(char * format, va_list args)
{
int temp;
int temp, i;
char *message = NULL;
char *last_message=NULL;
#if 0
@ -273,6 +273,13 @@ int HUD_init_message_va(char * format, va_list args)
message = &HUD_messages[hud_last][0];
vsprintf(message,format,args);
// clean message if necessary.
// using placeholders may mess up message string and crash game(s).
// block them also to prevent attacks from other clients.
for (i = 0; i <= strlen(message); i++)
if (message[i] == '%')
message [i] = ' ';
// Added by Leighton
if ((Game_mode & GM_MULTI) && FindArg("-noredundancy"))