bash-5.1-mbrtowc.patch 447 B

123456789101112
  1. diff --git a/subst.c b/subst.c
  2. --- a/subst.c
  3. +++ b/subst.c
  4. @@ -6240,7 +6240,7 @@ read_comsub (fd, quoted, flags, rflag)
  5. /* read a multibyte character from buf */
  6. /* punt on the hard case for now */
  7. memset (&ps, '\0', sizeof (mbstate_t));
  8. - mblen = mbrtowc (&wc, bufp-1, bufn+1, &ps);
  9. + mblen = mbrtowc (&wc, bufp-1, bufn, &ps);
  10. if (MB_INVALIDCH (mblen) || mblen == 0 || mblen == 1)
  11. istring[istring_index++] = c;
  12. else