diff options
author | Stephane Chazelas <stephane.chazelas@gmail.com> | 2017-12-22 22:17:09 +0000 |
---|---|---|
committer | Peter Stephenson <pws@zsh.org> | 2018-01-04 17:12:13 +0000 |
commit | c2cc8b0fbefc9868fa83537f5b6d90fc1ec438dd (patch) | |
tree | 7fde30b907d59b318cf4a291c056e0892ad51dda /Src/params.c | |
parent | 1e46f73b8e2e5e69dc40fd85ae83b88cccc1daf8 (diff) | |
download | zsh-c2cc8b0fbefc9868fa83537f5b6d90fc1ec438dd.tar.gz zsh-c2cc8b0fbefc9868fa83537f5b6d90fc1ec438dd.tar.xz zsh-c2cc8b0fbefc9868fa83537f5b6d90fc1ec438dd.zip |
Avoid crash copying empty hash table.
Visible with typeset -p.
Diffstat (limited to 'Src/params.c')
-rw-r--r-- | Src/params.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/Src/params.c b/Src/params.c index 31ff0445b..de7730ae7 100644 --- a/Src/params.c +++ b/Src/params.c @@ -549,10 +549,13 @@ scancopyparams(HashNode hn, UNUSED(int flags)) HashTable copyparamtable(HashTable ht, char *name) { - HashTable nht = newparamtable(ht->hsize, name); - outtable = nht; - scanhashtable(ht, 0, 0, 0, scancopyparams, 0); - outtable = NULL; + HashTable nht = 0; + if (ht) { + nht = newparamtable(ht->hsize, name); + outtable = nht; + scanhashtable(ht, 0, 0, 0, scancopyparams, 0); + outtable = NULL; + } return nht; } |