about summary refs log tree commit diff
diff options
context:
space:
mode:
-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;