Andreas Wacknitz
2022-11-11 03cc909ad8331b703091e983c87238ae32920349
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
                 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_ */