about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Src/subst.c5
2 files changed, 8 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index fdcb3ca2d..4e8fd65dc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2007-04-02  Peter Stephenson  <pws@csr.com>
+
+	* 23257: Src/subst.c: buffer too short for multibyte
+	${(#)...} evaluation.
+
 2007-03-31  Clint Adams  <clint@zsh.org>
 
 	* 23255: Completion/Unix/Command/_module: fix 23253 better.
diff --git a/Src/subst.c b/Src/subst.c
index 9d6a41305..5d7a44b05 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -1199,10 +1199,11 @@ substevalchar(char *ptr)
 	return NULL;
 #ifdef MULTIBYTE_SUPPORT
     if (isset(MULTIBYTE) && ires > 127) {
-	char buf[10];
+	/* '\\' + 'U' + 8 bytes of character + '\0' */
+	char buf[11];
 
 	/* inefficient: should separate out \U handling from getkeystring */
-	sprintf(buf, "\\U%.8x", (unsigned int)ires);
+	sprintf(buf, "\\U%.8x", (unsigned int)ires & 0xFFFFFFFFu);
 	ptr = getkeystring(buf, &len, GETKEYS_BINDKEY, NULL);
     }
     if (len == 0)