mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-03-22 02:42:20 +00:00
Merge branch 'key-out-of-range' into 'master'
Don't set controls to keys of array bounds See merge request STJr/SRB2!723
This commit is contained in:
commit
4b1a402731
1 changed files with 7 additions and 1 deletions
|
@ -662,7 +662,13 @@ INT32 G_KeyStringtoNum(const char *keystr)
|
|||
return keystr[0];
|
||||
|
||||
if (!strncmp(keystr, "KEY", 3) && keystr[3] >= '0' && keystr[3] <= '9')
|
||||
return atoi(&keystr[3]);
|
||||
{
|
||||
/* what if we out of range bruh? */
|
||||
j = atoi(&keystr[3]);
|
||||
if (j < NUMINPUTS)
|
||||
return j;
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (j = 0; j < NUMKEYNAMES; j++)
|
||||
if (!stricmp(keynames[j].name, keystr))
|
||||
|
|
Loading…
Reference in a new issue