]> git.ipfire.org Git - thirdparty/bash.git/commitdiff
Bash-5.1 patch 14: fix off-by-one error when reading multibyte characters from comman...
authorChet Ramey <chet.ramey@case.edu>
Tue, 4 Jan 2022 21:59:40 +0000 (16:59 -0500)
committerChet Ramey <chet.ramey@case.edu>
Tue, 4 Jan 2022 21:59:40 +0000 (16:59 -0500)
patchlevel.h
subst.c

index d8a1b2a9d7a9af0b2f4c83f792a0f27dd99b2c98..f2e80d19ca9fd6796e972c88e70c61b737dddaf4 100644 (file)
@@ -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 dda1d55ccc936989a1b2ba6085a48e8e2f52585e..2b76256c6535618c7d991a4fd2e3752d1e6d846e 100644 (file)
--- 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