Fix potential index out of bounds

This commit is contained in:
Johan Mattsson 2023-08-13 18:04:04 +02:00 committed by GitHub
parent 9316bd0ba2
commit 9c929ab463
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");
}