summaryrefslogtreecommitdiff
path: root/Src/subst.c
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 /Src/subst.c
parent85573e8ad115f3b66c052ffa45d7c41ee6f24eed (diff)
downloadzsh-a35302ebd4b02996481da9f13838125c201a6af3.tar.gz
zsh-a35302ebd4b02996481da9f13838125c201a6af3.zip
23257: buffer too short for multibyte ${(#)...} evalution
Diffstat (limited to 'Src/subst.c')
-rw-r--r--Src/subst.c5
1 files changed, 3 insertions, 2 deletions
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)