svashisht / rpms / bash

Forked from rpms/bash 4 years ago
Clone

Blame SOURCES/bash42-044

ff19ae
			     BASH PATCH REPORT
ff19ae
			     =================
ff19ae
ff19ae
Bash-Release:	4.2
ff19ae
Patch-ID:	bash42-044
ff19ae
ff19ae
Bug-Reported-by:	"Dashing" <dashing@hushmail.com>
ff19ae
Bug-Reference-ID:	<20130211175049.D90786F446@smtp.hushmail.com>
ff19ae
Bug-Reference-URL:	http://lists.gnu.org/archive/html/bug-bash/2013-02/msg00030.html
ff19ae
ff19ae
Bug-Description:
ff19ae
ff19ae
When converting a multibyte string to a wide character string as part of
ff19ae
pattern matching, bash does not handle the end of the string correctly,
ff19ae
causing the search for the NUL to go beyond the end of the string and
ff19ae
reference random memory.  Depending on the contents of that memory, bash
ff19ae
can produce errors or crash. 
ff19ae
ff19ae
Patch (apply with `patch -p0'):
ff19ae
ff19ae
*** ../bash-4.2-patched/lib/glob/xmbsrtowcs.c	2012-07-08 21:53:19.000000000 -0400
ff19ae
--- lib/glob/xmbsrtowcs.c	2013-02-12 12:00:39.000000000 -0500
ff19ae
***************
ff19ae
*** 217,220 ****
ff19ae
--- 217,226 ----
ff19ae
        n = mbsnrtowcs(wsbuf+wcnum, &p, nms, wsbuf_size-wcnum, &state);
ff19ae
  
ff19ae
+       if (n == 0 && p == 0)
ff19ae
+ 	{
ff19ae
+ 	  wsbuf[wcnum] = L'\0';
ff19ae
+ 	  break;
ff19ae
+ 	}
ff19ae
+ 
ff19ae
        /* Compensate for taking single byte on wcs conversion failure above. */
ff19ae
        if (wcslength == 1 && (n == 0 || n == (size_t)-1))
ff19ae
***************
ff19ae
*** 222,226 ****
ff19ae
  	  state = tmp_state;
ff19ae
  	  p = tmp_p;
ff19ae
! 	  wsbuf[wcnum++] = *p++;
ff19ae
  	}
ff19ae
        else
ff19ae
--- 228,238 ----
ff19ae
  	  state = tmp_state;
ff19ae
  	  p = tmp_p;
ff19ae
! 	  wsbuf[wcnum] = *p;
ff19ae
! 	  if (*p == 0)
ff19ae
! 	    break;
ff19ae
! 	  else
ff19ae
! 	    {
ff19ae
! 	      wcnum++; p++;
ff19ae
! 	    }
ff19ae
  	}
ff19ae
        else
ff19ae
ff19ae
*** ../bash-4.2-patched/patchlevel.h	Sat Jun 12 20:14:48 2010
ff19ae
--- patchlevel.h	Thu Feb 24 21:41:34 2011
ff19ae
***************
ff19ae
*** 26,30 ****
ff19ae
     looks for to find the patch level (for the sccs version string). */
ff19ae
  
ff19ae
! #define PATCHLEVEL 43
ff19ae
  
ff19ae
  #endif /* _PATCHLEVEL_H_ */
ff19ae
--- 26,30 ----
ff19ae
     looks for to find the patch level (for the sccs version string). */
ff19ae
  
ff19ae
! #define PATCHLEVEL 44
ff19ae
  
ff19ae
  #endif /* _PATCHLEVEL_H_ */