From cf8ef69fed73e98c2c93406c5e3feff25cfef4fb Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 19 Nov 2023 00:51:27 +0100 Subject: [PATCH] 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 --- src/sdl/i_system.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index a2eb279f8..a3813767c 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -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;