fix an overflow crash in terminal lul

could hold down the a key before and make the game crash

from https://git.do.srb2.org/STJr/SRB2/-/merge_requests/2206
This commit is contained in:
Alug committed 2023-11-19 00:51:27 +01:00
1 parent 2f5b894c47
commit cf8ef69fed
1 file changed
+2 -1
+2 -1
View File
@@ -666,6 +666,7 @@ void I_GetConsoleEvents(void)
return;
ev.type = ev_console;
ev.data1 = 0;
if (read(STDIN_FILENO, &key, 1) == -1 || !key)
return;
@@ -692,7 +693,7 @@ void I_GetConsoleEvents(void)
}
else return;
}
else
else if (tty_con.cursor < sizeof (tty_con.buffer))
{
// push regular character
ev.data1 = tty_con.buffer[tty_con.cursor] = key;