diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c
index b05f40ee375376bd7c585c3952daad2446580fca..450237149b08c9225b7204a9d31c63e311a06c29 100644
--- a/src/sdl/i_system.c
+++ b/src/sdl/i_system.c
@@ -608,6 +608,7 @@ void I_GetConsoleEvents(void)
 		return;
 
 	ev.type = ev_console;
+	ev.key = 0;
 	if (read(STDIN_FILENO, &key, 1) == -1 || !key)
 		return;
 
@@ -634,7 +635,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;