Skip to content

Commit c382cea

Browse files
committed
fix non-null pointer check (re: b7932e8)
src/cmd/ksh93/sh/xec.c: sh_funct(): - The np->nvalue.rp pointer was dereferenced before the check that it is non-null. Do this check before dereferencing it.
1 parent 352e68d commit c382cea

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

‎src/cmd/ksh93/sh/xec.c‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3234,11 +3234,14 @@ static void sh_funct(Shell_t *shp,Namval_t *np,int argn, char *argv[],struct arg
32343234
nv_putval(SH_FUNNAMENOD,fname,NV_NOFREE);
32353235
nv_putval(SH_PATHNAMENOD,shp->st.filename,NV_NOFREE);
32363236
shp->pipepid = pipepid;
3237-
np->nvalue.rp->running -= 2;
3238-
if(np->nvalue.rp && np->nvalue.rp->running==1)
3237+
if(np->nvalue.rp)
32393238
{
3240-
np->nvalue.rp->running = 0;
3241-
_nv_unset(np, NV_RDONLY);
3239+
np->nvalue.rp->running -= 2;
3240+
if(np->nvalue.rp->running==1)
3241+
{
3242+
np->nvalue.rp->running = 0;
3243+
_nv_unset(np, NV_RDONLY);
3244+
}
32423245
}
32433246
}
32443247

0 commit comments

Comments
 (0)