			     BASH PATCH REPORT
			     =================

Bash-Release:	5.2
Patch-ID:	bash52-005

Bug-Reported-by:	Justin Wood (Callek) <callek@gmail.com>
Bug-Reference-ID:	<CANBDKY9fp2yiXONP7RY4kNuRteuovUebxSJaqePHeu7cyaFS9Q@mail.gmail.com>
Bug-Reference-URL:	https://lists.gnu.org/archive/html/bug-bash/2022-10/msg00088.html

Bug-Description:

Null pattern substitution replacement strings can cause a crash.

Patch (apply with `patch -p0'):

*** ../bash-5.2-patched/subst.c	2022-10-05 10:22:02.000000000 -0400
--- subst.c	2022-10-13 16:57:26.000000000 -0400
***************
*** 8966,8970 ****
      }
    else if (*string == 0 && (match_pattern (string, pat, mtype, &s, &e) != 0))
!     return ((mflags & MATCH_EXPREP) ? strcreplace (rep, '&', "", 2) : savestring (rep));
  
    ret = (char *)xmalloc (rsize = 64);
--- 8966,8971 ----
      }
    else if (*string == 0 && (match_pattern (string, pat, mtype, &s, &e) != 0))
!     return (mflags & MATCH_EXPREP) ? strcreplace (rep, '&', "", 2)
! 				   : (rep ? savestring (rep) : savestring (""));
  
    ret = (char *)xmalloc (rsize = 64);
*** ../bash-5.2/patchlevel.h	2020-06-22 14:51:03.000000000 -0400
--- patchlevel.h	2020-10-01 11:01:28.000000000 -0400
***************
*** 26,30 ****
     looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 4
  
  #endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
     looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 5
  
  #endif /* _PATCHLEVEL_H_ */
