about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOliver Kiddle <opk@zsh.org>2023-10-08 23:47:25 +0200
committerOliver Kiddle <opk@zsh.org>2023-10-11 00:43:05 +0200
commit83f8a71a7cc2137a1d4638228b3d83717c15af54 (patch)
treebe450a54ca09c900577afcd18a9eb64cbef2d8df
parenta920e368b87f24e95b015eb091e1112c378c2939 (diff)
downloadzsh-83f8a71a7cc2137a1d4638228b3d83717c15af54.tar.gz
zsh-83f8a71a7cc2137a1d4638228b3d83717c15af54.tar.xz
zsh-83f8a71a7cc2137a1d4638228b3d83717c15af54.zip
52214: allow extra byte for nul terminator in allocation
-rw-r--r--ChangeLog2
-rw-r--r--Src/subst.c2
2 files changed, 3 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 3e9b6ffa0..9e0a94b10 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2023-10-10  Oliver Kiddle  <opk@zsh.org>
 
+	* 52214: Src/subst.c: allow extra byte for nul in allocation
+
 	* unposted (cf. 52166): Functions/Misc/run-help-svk:
 	remove obsolete helper for svk
 
diff --git a/Src/subst.c b/Src/subst.c
index cdbfc138a..60d850feb 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -1506,7 +1506,7 @@ substevalchar(char *ptr)
     }
 #ifdef MULTIBYTE_SUPPORT
     else if (isset(MULTIBYTE) && ires > 127) {
-	ptr = zhalloc(MB_CUR_MAX);
+	ptr = zhalloc(MB_CUR_MAX+1);
 	len = ucs4tomb((unsigned int)ires & 0xffffffff, ptr);
     }
     if (len <= 0)