mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-02-13 11:42:21 +00:00
Fix crash on unsetting .sh.match
ksh crashed after unsetting .sh.match and then matching a pattern: $ unset .sh.match $ [[ bar == ba* ]] Memory fault src/cmd/ksh93/sh/init.c: sh_setmatch(): - Do nothing if we cannot get an array pointer to SH_MATCHNOD.
This commit is contained in:
parent
31fe1c2890
commit
a4375f3090
2 changed files with 5 additions and 0 deletions
2
NEWS
2
NEWS
|
@ -5,6 +5,8 @@ Any uppercase BUG_* names are modernish shell bug IDs.
|
|||
|
||||
2021-11-14:
|
||||
|
||||
- Fixed: ksh crashed after unsetting .sh.match and then matching a pattern.
|
||||
|
||||
- Another test/[ fix: "test \( string1 -a string2 \)" and "test \( string1 -o
|
||||
string2 \)" no longer give an incorrect "argument expected" error message.
|
||||
|
||||
|
|
|
@ -783,6 +783,9 @@ void sh_setmatch(Shell_t *shp,const char *v, int vsize, int nmatch, regoff_t mat
|
|||
unsigned int savesub = shp->subshell;
|
||||
Namarr_t *ap = nv_arrayptr(SH_MATCHNOD);
|
||||
Namarr_t *ap_save = ap;
|
||||
/* do not crash if .sh.match is unset */
|
||||
if(!ap)
|
||||
return;
|
||||
shp->subshell = 0;
|
||||
#if !SHOPT_2DMATCH
|
||||
index = 0;
|
||||
|
|
Loading…
Reference in a new issue