1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-12 16:23:57 +00:00

(readline): Terminate buffer properly when EOF seen.

Test for valid pointer before dereferencing it.
This commit is contained in:
Karl Heuer 1997-06-14 04:36:44 +00:00
parent 12e36cdba6
commit 5326c1d687

View File

@ -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;