diff options
author | Bart Schaefer <schaefer@zsh.org> | 2024-02-17 20:27:56 -0800 |
---|---|---|
committer | Bart Schaefer <schaefer@zsh.org> | 2024-02-17 20:27:56 -0800 |
commit | 8c59638522d8ed06cb962d41c11d1fade27abaa9 (patch) | |
tree | 9cef2f43847204fefeb8adac2e4f24d4afadb350 /Src/builtin.c | |
parent | 74722b8d4ed20828950d396a523dcde1aa10b466 (diff) | |
download | zsh-8c59638522d8ed06cb962d41c11d1fade27abaa9.tar.gz zsh-8c59638522d8ed06cb962d41c11d1fade27abaa9.tar.xz zsh-8c59638522d8ed06cb962d41c11d1fade27abaa9.zip |
52556: fix crash when changing type of unset referent via named reference
Diffstat (limited to 'Src/builtin.c')
-rw-r--r-- | Src/builtin.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Src/builtin.c b/Src/builtin.c index 5c5adb9d3..dd352c146 100644 --- a/Src/builtin.c +++ b/Src/builtin.c @@ -2031,8 +2031,10 @@ typeset_single(char *cname, char *pname, Param pm, int func, char *subscript; if (pm && (pm->node.flags & PM_NAMEREF) && !((off|on) & PM_NAMEREF)) { - if (!(off & PM_NAMEREF)) - pm = (Param)resolve_nameref(pm, NULL); + if (!(off & PM_NAMEREF)) { + if ((pm = (Param)resolve_nameref(pm, NULL))) + pname = pm->node.nam; + } if (pm && (pm->node.flags & PM_NAMEREF) && (on & ~(PM_NAMEREF|PM_LOCAL|PM_READONLY))) { /* Changing type of PM_SPECIAL|PM_AUTOLOAD is a fatal error. * |