Bash-5.1 patch 14: fix off-by-one error when reading multibyte characters from command substitution output

This commit is contained in:
Chet Ramey
2022-01-04 16:59:40 -05:00
parent 6b9422dbe3
commit 72912fb820
2 changed files with 2 additions and 2 deletions
+1 -1
View 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_ */
+1 -1
View File
@@ -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