Skip to content

Commit

Permalink
fix non-null pointer check (re: b7932e8)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
McDutchie committed Sep 25, 2020
1 parent 352e68d commit c382cea
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/cmd/ksh93/sh/xec.c
Original file line number Diff line number Diff line change
Expand Up @@ -3234,11 +3234,14 @@ static void sh_funct(Shell_t *shp,Namval_t *np,int argn, char *argv[],struct arg
nv_putval(SH_FUNNAMENOD,fname,NV_NOFREE);
nv_putval(SH_PATHNAMENOD,shp->st.filename,NV_NOFREE);
shp->pipepid = pipepid;
np->nvalue.rp->running -= 2;
if(np->nvalue.rp && np->nvalue.rp->running==1)
if(np->nvalue.rp)
{
np->nvalue.rp->running = 0;
_nv_unset(np, NV_RDONLY);
np->nvalue.rp->running -= 2;
if(np->nvalue.rp->running==1)
{
np->nvalue.rp->running = 0;
_nv_unset(np, NV_RDONLY);
}
}
}

Expand Down

0 comments on commit c382cea

Please sign in to comment.