mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2024-11-10 07:21:58 +00:00
cl_parse.c: make sure not to out-of-bounds read svc_strings[] array
This commit is contained in:
parent
87a08ae157
commit
707507e9a3
1 changed files with 5 additions and 2 deletions
|
@ -96,6 +96,7 @@ const char *svc_strings[] =
|
|||
"svc_backtolobby", // 55
|
||||
"svc_localsound" // 56
|
||||
};
|
||||
#define NUM_SVC_STRINGS (sizeof(svc_strings) / sizeof(svc_strings[0]))
|
||||
|
||||
qboolean warn_about_nehahra_protocol; //johnfitz
|
||||
|
||||
|
@ -986,13 +987,15 @@ void CL_ParseServerMessage (void)
|
|||
continue;
|
||||
}
|
||||
|
||||
SHOWNET(svc_strings[cmd]);
|
||||
if (cmd < (int)NUM_SVC_STRINGS) {
|
||||
SHOWNET(svc_strings[cmd]);
|
||||
}
|
||||
|
||||
// other commands
|
||||
switch (cmd)
|
||||
{
|
||||
default:
|
||||
Host_Error ("Illegible server message, previous was %s", svc_strings[lastcmd]); //johnfitz -- added svc_strings[lastcmd]
|
||||
Host_Error ("Illegible server message %d (previous was %d)", cmd, lastcmd);
|
||||
break;
|
||||
|
||||
case svc_nop:
|
||||
|
|
Loading…
Reference in a new issue