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:
parent
12e36cdba6
commit
5326c1d687
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user