mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2025-02-13 15:31:28 +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_backtolobby", // 55
|
||||||
"svc_localsound" // 56
|
"svc_localsound" // 56
|
||||||
};
|
};
|
||||||
|
#define NUM_SVC_STRINGS (sizeof(svc_strings) / sizeof(svc_strings[0]))
|
||||||
|
|
||||||
qboolean warn_about_nehahra_protocol; //johnfitz
|
qboolean warn_about_nehahra_protocol; //johnfitz
|
||||||
|
|
||||||
|
@ -986,13 +987,15 @@ void CL_ParseServerMessage (void)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cmd < (int)NUM_SVC_STRINGS) {
|
||||||
SHOWNET(svc_strings[cmd]);
|
SHOWNET(svc_strings[cmd]);
|
||||||
|
}
|
||||||
|
|
||||||
// other commands
|
// other commands
|
||||||
switch (cmd)
|
switch (cmd)
|
||||||
{
|
{
|
||||||
default:
|
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;
|
break;
|
||||||
|
|
||||||
case svc_nop:
|
case svc_nop:
|
||||||
|
|
Loading…
Reference in a new issue