Commit a0449d92 authored by Chris Allegretta's avatar Chris Allegretta
Browse files

- files.c: load_history() - Fix segfault on loading huge strings from history...

- files.c: load_history() - Fix segfault on loading huge strings from history file (David Benbennick)


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1455 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
parent 7641708c
No related merge requests found
Showing with 4 additions and 1 deletion
+4 -1
......@@ -23,6 +23,9 @@ CVS code
intput_tab()
- Fix assumption that matches is null terminated (David
Benbennick).
load_history()
- Fix segfault on loading huge strings from history file
(David Benbennick).
- nano.c:
breakable()
- Fix incorrect return value on short lines (David Benbennick).
......
......@@ -2896,7 +2896,7 @@ void load_history(void)
buf = charalloc(1024);
while (fgets(buf, 1023, hist) != 0) {
ptr = buf;
while (*ptr != '\n')
while (*ptr != '\n' && *ptr != '\0' && ptr < buf + 1023)
ptr++;
*ptr = '\0';
if (strlen(buf))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment