Merge pull request #1043 from mjunix/master-1

Fix potential index out of bounds
This commit is contained in:
Yamagi 2023-09-14 20:58:52 +02:00 committed by GitHub
commit d466b8cf51
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1131,7 +1131,7 @@ SCR_ExecuteLayoutString(char *s)
token = COM_Parse(&s);
index = (int)strtol(token, (char **)NULL, 10);
if ((index < 0) || (index >= sizeof(cl.frame.playerstate.stats)))
if ((index < 0) || (index >= MAX_STATS))
{
Com_Error(ERR_DROP, "bad stats index %d (0x%x)", index, index);
}
@ -1358,7 +1358,7 @@ SCR_ExecuteLayoutString(char *s)
token = COM_Parse(&s);
index = (int)strtol(token, (char **)NULL, 10);
if ((index < 0) || (index >= MAX_CONFIGSTRINGS))
if ((index < 0) || (index >= MAX_STATS))
{
Com_Error(ERR_DROP, "Bad stat_string index");
}