Update i_system.c

Add a check for overflowing the TERIOS buffer
This commit is contained in:
Alam Ed Arias 2023-11-09 20:21:04 -05:00
parent 7643ffadbc
commit 2062553d22

View file

@ -607,6 +607,7 @@ void I_GetConsoleEvents(void)
return;
ev.type = ev_console;
ev.key = 0;
if (read(STDIN_FILENO, &key, 1) == -1 || !key)
return;
@ -633,7 +634,7 @@ void I_GetConsoleEvents(void)
}
else return;
}
else
else if (tty_con.cursor < sizeof (tty_con.buffer))
{
// push regular character
ev.key = tty_con.buffer[tty_con.cursor] = key;