summaryrefslogtreecommitdiffstats
path: root/debian/patches/bash51-014.diff
blob: 47dfe35f4d6bf9222f1a7f198b5bceb5dd3162c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
			     BASH PATCH REPORT
			     =================

Bash-Release:	5.1
Patch-ID:	bash51-014

Bug-Reported-by:	platon7pronko@gmail.com
Bug-Reference-ID:
Bug-Reference-URL:	https://savannah.gnu.org/patch/?10035

Bug-Description:

Bash may produce corrupted input if a multibyte character spans a 512-byte
boundary while reading the output of a command substitution.

--- 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