Mercurial > emacs
changeset 18238:1f3d8941aba2
(readline): Terminate buffer properly when EOF seen.
Test for valid pointer before dereferencing it.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Sat, 14 Jun 1997 04:36:44 +0000 |
parents | 69bb3a2c95b3 |
children | a01702d67089 |
files | lib-src/b2m.c |
diffstat | 1 files changed, 2 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/lib-src/b2m.c Fri Jun 13 21:31:25 1997 +0000 +++ b/lib-src/b2m.c Sat Jun 14 04:36:44 1997 +0000 @@ -211,12 +211,13 @@ } 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;