about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2007-04-02 11:00:35 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2007-04-02 11:00:35 +0000
commita35302ebd4b02996481da9f13838125c201a6af3 (patch)
tree2e98a932d4c9a7791896598891a01410c8d254e1
parent85573e8ad115f3b66c052ffa45d7c41ee6f24eed (diff)
downloadzsh-a35302ebd4b02996481da9f13838125c201a6af3.tar.gz
zsh-a35302ebd4b02996481da9f13838125c201a6af3.tar.xz
zsh-a35302ebd4b02996481da9f13838125c201a6af3.zip
23257: buffer too short for multibyte ${(#)...} evalution
-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)