From 1727083501a3a25c59544e1d535ae9e5f5ffc8a6 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Mon, 15 Nov 1993 12:28:01 +0000 Subject: [PATCH] (read_avail_input): Make cbuf 1 char shorter. --- src/keyboard.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/keyboard.c b/src/keyboard.c index 249c594d2a8..47092b339fe 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -3027,7 +3027,10 @@ read_avail_input (expected) nread = (*read_socket_hook) (0, buf, KBD_BUFFER_SIZE, expected, expected); else { - unsigned char cbuf[KBD_BUFFER_SIZE]; + /* Using KBD_BUFFER_SIZE - 1 here avoids reading more than + the kbd_buffer can really hold. That may prevent loss + of characters on some systems when input is stuffed at us. */ + unsigned char cbuf[KBD_BUFFER_SIZE - 1]; #ifdef FIONREAD /* Find out how much input is available. */ -- 2.39.5