From 2062553d22a5c4a544f11080e17a09addf93cd1b Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Thu, 9 Nov 2023 20:21:04 -0500 Subject: [PATCH] Update i_system.c Add a check for overflowing the TERIOS buffer --- 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 2a26f3f50..9dd80e6ef 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -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;