diff options
| author | Karoly Lorentey | 2004-02-20 17:48:48 +0000 |
|---|---|---|
| committer | Karoly Lorentey | 2004-02-20 17:48:48 +0000 |
| commit | 823a1258f649b857a1e45c0192a31c088ae02c88 (patch) | |
| tree | 58d8173cfaa1a0ab850b66c7d1f88f4d95ec9f93 /src | |
| parent | a225e738abdeb149e9b4bc87d5f9d9a201160aa2 (diff) | |
| download | emacs-823a1258f649b857a1e45c0192a31c088ae02c88.tar.gz emacs-823a1258f649b857a1e45c0192a31c088ae02c88.zip | |
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
Diffstat (limited to 'src')
| -rw-r--r-- | src/keyboard.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/keyboard.c b/src/keyboard.c index 4cae90cd764..e3e6896d0da 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -6667,10 +6667,10 @@ tty_read_avail_input (struct display *display, | |||
| 6667 | struct input_event *buf, | 6667 | struct input_event *buf, |
| 6668 | int numchars, int expected) | 6668 | int numchars, int expected) |
| 6669 | { | 6669 | { |
| 6670 | /* Using KBD_BUFFER_SIZE - 1 here avoids reading more than | 6670 | /* Using numchars - 1 here avoids reading more than the buf can |
| 6671 | the kbd_buffer can really hold. That may prevent loss | 6671 | really hold. That may prevent loss of characters on some systems |
| 6672 | of characters on some systems when input is stuffed at us. */ | 6672 | when input is stuffed at us. */ |
| 6673 | unsigned char cbuf[KBD_BUFFER_SIZE - 1]; | 6673 | unsigned char cbuf[numchars - 1]; |
| 6674 | int n_to_read, i; | 6674 | int n_to_read, i; |
| 6675 | struct tty_display_info *tty = display->display_info.tty; | 6675 | struct tty_display_info *tty = display->display_info.tty; |
| 6676 | int nread = 0; | 6676 | int nread = 0; |