[client] app: prevent possible out of bounds array access

This commit is contained in:
Geoffrey McRae 2023-11-11 13:10:54 +11:00
parent 417c9cf092
commit f59ef4422a

View File

@ -345,7 +345,10 @@ void app_handleKeyPress(int sc, int charcode)
if (sc == KEY_ESC)
app_setOverlay(false);
else
{
if (sc < sizeof(g_state.io->KeysDown))
g_state.io->KeysDown[sc] = true;
}
return;
}
@ -388,6 +391,7 @@ void app_handleKeyRelease(int sc, int charcode)
if (app_isOverlayMode())
{
if (sc < sizeof(g_state.io->KeysDown))
g_state.io->KeysDown[sc] = false;
return;
}