Commit 566344b4 authored by serg@serg.mylan's avatar serg@serg.mylan

libedit safety fix: account for closing \0

parent df1d90d1
...@@ -647,7 +647,7 @@ history_save(History *h, const char *fname) ...@@ -647,7 +647,7 @@ history_save(History *h, const char *fname)
for (retval = HLAST(h, &ev); for (retval = HLAST(h, &ev);
retval != -1; retval != -1;
retval = HPREV(h, &ev), i++) { retval = HPREV(h, &ev), i++) {
len = strlen(ev.str) * 4; len = strlen(ev.str) * 4 + 1;
if (len >= max_size) { if (len >= max_size) {
max_size = (len + 1023) & ~1023; max_size = (len + 1023) & ~1023;
ptr = h_realloc(ptr, max_size); ptr = h_realloc(ptr, max_size);
......
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