diff --git a/src/keyboard.c b/src/keyboard.c index de91b40d295..9c41fa91351 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -6685,10 +6685,10 @@ tty_read_avail_input (struct display *display, struct input_event *buf, int numchars, int expected) { - /* Using numchars - 1 here avoids reading more than the buf can + /* Using numchars here avoids reading more than the buf can really hold. That may prevent loss of characters on some systems when input is stuffed at us. */ - unsigned char cbuf[numchars - 1]; + unsigned char cbuf[numchars]; int n_to_read, i; struct tty_display_info *tty = display->display_info.tty; int nread = 0;