mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-27 04:41:23 +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));
|
key = G_KeyStringtoNum(COM_Argv(1));
|
||||||
if (!key)
|
if (key <= 0 || key >= NUMINPUTS)
|
||||||
{
|
{
|
||||||
CONS_Alert(CONS_NOTICE, M_GetText("Invalid key name\n"));
|
CONS_Alert(CONS_NOTICE, M_GetText("Invalid key name\n"));
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1042,13 +1042,13 @@ INT32 G_KeyStringtoNum(const char *keystr)
|
||||||
if (!keystr[1] && keystr[0] > ' ' && keystr[0] <= 'z')
|
if (!keystr[1] && keystr[0] > ' ' && keystr[0] <= 'z')
|
||||||
return keystr[0];
|
return keystr[0];
|
||||||
|
|
||||||
|
if (!strncmp(keystr, "KEY", 3) && keystr[3] >= '0' && keystr[3] <= '9')
|
||||||
|
return atoi(&keystr[3]);
|
||||||
|
|
||||||
for (j = 0; j < NUMKEYNAMES; j++)
|
for (j = 0; j < NUMKEYNAMES; j++)
|
||||||
if (!stricmp(keynames[j].name, keystr))
|
if (!stricmp(keynames[j].name, keystr))
|
||||||
return keynames[j].keynum;
|
return keynames[j].keynum;
|
||||||
|
|
||||||
if (strlen(keystr) > 3)
|
|
||||||
return atoi(&keystr[3]);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue