sh_funscope(): Fix possible dereference of null pointer

Patch from OpenSUSE:
https://build.opensuse.org/package/view_file/shells/ksh/ksh93-unset-f.dif
This commit is contained in:
Martijn Dekker 2021-01-28 04:38:48 +00:00
parent 129614b99f
commit c52cb93999
1 changed files with 2 additions and 1 deletions

View File

@ -3120,7 +3120,8 @@ int sh_funscope(int argn, char *argv[],int(*fun)(void*),void *arg,int execflg)
shp->st.var_local = shp->var_tree;
if(!fun)
{
shp->st.filename = fp->node->nvalue.rp->fname;
if(fp->node->nvalue.rp)
shp->st.filename = fp->node->nvalue.rp->fname;
shp->st.funname = nv_name(fp->node);
shp->last_root = nv_dict(DOTSHNOD);
nv_putval(SH_PATHNAMENOD,shp->st.filename,NV_NOFREE);