summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChet Ramey <chet.ramey@case.edu>2022-01-04 16:59:40 -0500
committerChet Ramey <chet.ramey@case.edu>2022-01-04 16:59:40 -0500
commit72912fb8209105af961c851260a173115efe60be (patch)
tree192e284d850cc61a78ace676c5f8ae2942286386
parent6b9422dbe3917a0affb4898e38156d22cbec64e8 (diff)
downloadbash-72912fb8209105af961c851260a173115efe60be.tar.gz
Bash-5.1 patch 14: fix off-by-one error when reading multibyte characters from command substitution output
-rw-r--r--patchlevel.h2
-rw-r--r--subst.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/patchlevel.h b/patchlevel.h
index d8a1b2a9..f2e80d19 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 dda1d55c..2b76256c 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