# HG changeset patch # User Karoly Lorentey # Date 1077299328 0 # Node ID b8aef5cd0bf2bc74f95eab237b9dfecead8a4075 # Parent 6034d48182e8a013bd340b69452ef7028f7a2cdc Don't read too many characters from the tty. src/keyboard.c (tty_read_avail_input): Don't read more characters than numchars. (Prevents a crash if there are many characters in the buffer.) git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-89 diff -r 6034d48182e8 -r b8aef5cd0bf2 src/keyboard.c --- a/src/keyboard.c Fri Feb 20 15:42:55 2004 +0000 +++ b/src/keyboard.c Fri Feb 20 17:48:48 2004 +0000 @@ -6667,10 +6667,10 @@ struct input_event *buf, int numchars, int expected) { - /* 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]; + /* Using numchars - 1 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]; int n_to_read, i; struct tty_display_info *tty = display->display_info.tty; int nread = 0;