diff options
author | Karl Heuer <kwzh@gnu.org> | 1997-06-14 04:36:44 +0000 |
---|---|---|
committer | Karl Heuer <kwzh@gnu.org> | 1997-06-14 04:36:44 +0000 |
commit | 5326c1d6879b987a9aa921ab49fda3421b54d18b (patch) | |
tree | 8d7b3153e8ef0b2b4ee4081dbb9a28d26969d5c7 /lib-src/b2m.c | |
parent | 12e36cdba6e04be2ef6aeb76f5419a620ba0eac4 (diff) | |
download | emacs-5326c1d6879b987a9aa921ab49fda3421b54d18b.tar.gz |
(readline): Terminate buffer properly when EOF seen.
Test for valid pointer before dereferencing it.
Diffstat (limited to 'lib-src/b2m.c')
-rw-r--r-- | lib-src/b2m.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib-src/b2m.c b/lib-src/b2m.c index 88d0acd5cd8..2eb6a0354b8 100644 --- a/lib-src/b2m.c +++ b/lib-src/b2m.c @@ -211,12 +211,13 @@ readline (linebuffer, stream) } if (c == EOF) { + *p = '\0'; chars_deleted = 0; break; } if (c == '\n') { - if (p[-1] == '\r' && p > buffer) + if (p > buffer && p[-1] == '\r') { *--p = '\0'; chars_deleted = 2; |