mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 01:01:33 +00:00
fix bind out of bounds / keystring misreading
This commit is contained in:
parent
732c1a87f1
commit
d76e21b546
2 changed files with 4 additions and 4 deletions
|
@ -202,7 +202,7 @@ static void CONS_Bind_f(void)
|
|||
}
|
||||
|
||||
key = G_KeyStringtoNum(COM_Argv(1));
|
||||
if (!key)
|
||||
if (key <= 0 || key >= NUMINPUTS)
|
||||
{
|
||||
CONS_Alert(CONS_NOTICE, M_GetText("Invalid key name\n"));
|
||||
return;
|
||||
|
|
|
@ -1042,13 +1042,13 @@ INT32 G_KeyStringtoNum(const char *keystr)
|
|||
if (!keystr[1] && keystr[0] > ' ' && keystr[0] <= 'z')
|
||||
return keystr[0];
|
||||
|
||||
if (!strncmp(keystr, "KEY", 3) && keystr[3] >= '0' && keystr[3] <= '9')
|
||||
return atoi(&keystr[3]);
|
||||
|
||||
for (j = 0; j < NUMKEYNAMES; j++)
|
||||
if (!stricmp(keynames[j].name, keystr))
|
||||
return keynames[j].keynum;
|
||||
|
||||
if (strlen(keystr) > 3)
|
||||
return atoi(&keystr[3]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue