Mercurial > emacs
diff src/keyboard.c @ 83049:b8aef5cd0bf2
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
author | Karoly Lorentey <lorentey@elte.hu> |
---|---|
date | Fri, 20 Feb 2004 17:48:48 +0000 |
parents | 55d4fe5962fd |
children | 84bfe7168c06 |
line wrap: on
line diff
--- 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;