From 566344b42e34f7137537cff89ec4ad3f3808737e Mon Sep 17 00:00:00 2001
From: "serg@serg.mylan" <>
Date: Sat, 21 Aug 2004 23:53:42 +0200
Subject: [PATCH] libedit safety fix: account for closing \0

---
 cmd-line-utils/libedit/history.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cmd-line-utils/libedit/history.c b/cmd-line-utils/libedit/history.c
index 457c8f4a76..bae50787b9 100644
--- a/cmd-line-utils/libedit/history.c
+++ b/cmd-line-utils/libedit/history.c
@@ -647,7 +647,7 @@ history_save(History *h, const char *fname)
 	for (retval = HLAST(h, &ev);
 	    retval != -1;
 	    retval = HPREV(h, &ev), i++) {
-		len = strlen(ev.str) * 4;
+		len = strlen(ev.str) * 4 + 1;
 		if (len >= max_size) {
 			max_size = (len + 1023) & ~1023;
 			ptr = h_realloc(ptr, max_size);
-- 
2.30.9