about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2005-01-26 12:34:31 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2005-01-26 12:34:31 +0000
commit77bd05014d086bc76d42b8be656cb299d811376a (patch)
tree75be3dc90c6f75ec42fd3e3d8e961afd4baca902
parentefd03cf9e892d8faade5c2012ebfd6fac02664d4 (diff)
downloadzsh-77bd05014d086bc76d42b8be656cb299d811376a.tar.gz
zsh-77bd05014d086bc76d42b8be656cb299d811376a.tar.xz
zsh-77bd05014d086bc76d42b8be656cb299d811376a.zip
20750: fix hang with 20742
-rw-r--r--ChangeLog5
-rw-r--r--Src/Zle/zle_utils.c11
2 files changed, 14 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 2cbeedf88..728de3ca9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2005-01-26  Peter Stephenson  <pws@csr.com>
+
+	* 20750: Src/zle_utils.c: 20742 could cause hang when line
+	resized to empty.
+
 2005-01-25  Peter Stephenson  <pws@csr.com>
 
 	* 20742: Src/system.h, Src/Zle/zle.h, Src/Zle/zle_main.c,
diff --git a/Src/Zle/zle_utils.c b/Src/Zle/zle_utils.c
index a3f3d83a4..0e8099bd2 100644
--- a/Src/Zle/zle_utils.c
+++ b/Src/Zle/zle_utils.c
@@ -67,9 +67,16 @@ void
 sizeline(int sz)
 {
     while (sz > linesz)
-	zleline = 
+    {
+	if (linesz < 256)
+	    linesz = 256;
+	else
+	    linesz *= 4;
+
+	zleline =
 	    (ZLE_STRING_T)realloc(zleline,
-				  ((linesz *= 4) + 2) * ZLE_CHAR_SIZE);
+				  (linesz + 2) * ZLE_CHAR_SIZE);
+    }
 }
 
 /*