Skip to content
Snippets Groups Projects
Commit f0daea39 authored by James R.'s avatar James R.
Browse files

Don't set controls to keys out of array bounds

Shout-out to TAG's config that somehow had
`setcontrol2 "custom3" "KEY931926528"`, cuasing the game to crash only in
Splitscreen.
parent a6d49eaa
Branches
Tags
1 merge request!723Don't set controls to keys of array bounds
......@@ -662,7 +662,14 @@ 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;
else
return 0;
}
for (j = 0; j < NUMKEYNAMES; j++)
if (!stricmp(keynames[j].name, keystr))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment