From: Chet Ramey Date: Tue, 4 Jan 2022 21:59:40 +0000 (-0500) Subject: Bash-5.1 patch 14: fix off-by-one error when reading multibyte characters from comman... X-Git-Tag: bash-5.2-alpha~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=72912fb8209105af961c851260a173115efe60be;p=thirdparty%2Fbash.git Bash-5.1 patch 14: fix off-by-one error when reading multibyte characters from command substitution output --- diff --git a/patchlevel.h b/patchlevel.h index d8a1b2a9d..f2e80d19c 100644 --- a/patchlevel.h +++ b/patchlevel.h @@ -25,6 +25,6 @@ regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh looks for to find the patch level (for the sccs version string). */ -#define PATCHLEVEL 13 +#define PATCHLEVEL 14 #endif /* _PATCHLEVEL_H_ */ diff --git a/subst.c b/subst.c index dda1d55cc..2b76256c6 100644 --- a/subst.c +++ b/subst.c @@ -6242,7 +6242,7 @@ read_comsub (fd, quoted, flags, rflag) /* read a multibyte character from buf */ /* punt on the hard case for now */ memset (&ps, '\0', sizeof (mbstate_t)); - mblen = mbrtowc (&wc, bufp-1, bufn+1, &ps); + mblen = mbrtowc (&wc, bufp-1, bufn, &ps); if (MB_INVALIDCH (mblen) || mblen == 0 || mblen == 1) istring[istring_index++] = c; else