summary refs log tree commit diff
diff options
context:
space:
mode:
authorOliver Kiddle <opk@users.sourceforge.net>2003-03-18 14:39:41 +0000
committerOliver Kiddle <opk@users.sourceforge.net>2003-03-18 14:39:41 +0000
commita2197a53619444fa32bb7c26aadea3f1e498e069 (patch)
tree51dae89981da677d577fb653005e1d8a8bcb0ddd
parente0ae2a59b3842e23264b19c2d1702a9c998e7278 (diff)
downloadzsh-a2197a53619444fa32bb7c26aadea3f1e498e069.tar.gz
zsh-a2197a53619444fa32bb7c26aadea3f1e498e069.tar.xz
zsh-a2197a53619444fa32bb7c26aadea3f1e498e069.zip
18359: fix bug where not enough memory was allocated if MB_LEN_MAX < 6
-rw-r--r--ChangeLog5
-rw-r--r--Src/utils.c5
2 files changed, 6 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 781e148b0..78904ba9b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2003-03-18  Oliver Kiddle  <opk@zsh.org>
+
+	* 18359: Src/utils.c: fix bug from 18343 where not enough memory
+	was allocated if MB_LEN_MAX < 6
+
 2003-03-18  Doug Kearns  <djkea2@mugca.its.monash.edu.au>
 
 	* unposted: Completion/Unix/Command/_xmlsoft: remove unnecessary
diff --git a/Src/utils.c b/Src/utils.c
index 2b0e7faea..57a5e6771 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -3311,15 +3311,12 @@ getkeystring(char *s, int *len, int fromwhere, int *misc)
     char *inptr, *outptr;
 #  endif
     size_t count;
-    size_t buflen = MB_LEN_MAX * (strlen(s) / 6) + (strlen(s) % 6) + 1;
-#else
-    size_t buflen = strlen(s) + 1;
 #endif
 
     if (fromwhere == 6)
 	t = buf = tmp;
     else if (fromwhere != 4)
-	t = buf = zhalloc(buflen);
+	t = buf = zhalloc(strlen(s) + 1);
     else {
 	t = buf = s;
 	s += 2;