1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

fix non-null pointer check (re: b7932e87)

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.
This commit is contained in:
Martijn Dekker 2020-09-25 23:46:24 +02:00
parent 352e68dabd
commit c382cea176

View file

@ -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_FUNNAMENOD,fname,NV_NOFREE);
nv_putval(SH_PATHNAMENOD,shp->st.filename,NV_NOFREE); nv_putval(SH_PATHNAMENOD,shp->st.filename,NV_NOFREE);
shp->pipepid = pipepid; shp->pipepid = pipepid;
np->nvalue.rp->running -= 2; if(np->nvalue.rp)
if(np->nvalue.rp && np->nvalue.rp->running==1)
{ {
np->nvalue.rp->running = 0; np->nvalue.rp->running -= 2;
_nv_unset(np, NV_RDONLY); if(np->nvalue.rp->running==1)
{
np->nvalue.rp->running = 0;
_nv_unset(np, NV_RDONLY);
}
} }
} }