File CVE-2018-7549.patch of Package zsh.7007

commit c2cc8b0fbefc9868fa83537f5b6d90fc1ec438dd
Author: Stephane Chazelas <stephane.chazelas@gmail.com>
Date:   Fri Dec 22 22:17:09 2017 +0000

    Avoid crash copying empty hash table.
    
    Visible with typeset -p.

Index: zsh-5.0.5/Src/params.c
===================================================================
--- zsh-5.0.5.orig/Src/params.c
+++ zsh-5.0.5/Src/params.c
@@ -498,10 +498,13 @@ scancopyparams(HashNode hn, UNUSED(int f
 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;
 }
 
openSUSE Build Service is sponsored by