Sanitise freeing of DSA keys.
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Sun, 4 Aug 2013 19:33:43 +0000 (19:33 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Sun, 4 Aug 2013 19:33:43 +0000 (19:33 +0000)
git-svn-id: svn://svn.tartarus.org/sgt/putty@9984 cda61777-01e9-0310-a592-d414129be87e

sshdss.c

index 6487d75..8c9f93e 100644 (file)
--- a/sshdss.c
+++ b/sshdss.c
@@ -111,6 +111,7 @@ static void *dss_newkey(char *data, int len)
     dss->q = getmp(&data, &len);
     dss->g = getmp(&data, &len);
     dss->y = getmp(&data, &len);
+    dss->x = NULL;
 
     return dss;
 }
@@ -118,10 +119,16 @@ static void *dss_newkey(char *data, int len)
 static void dss_freekey(void *key)
 {
     struct dss_key *dss = (struct dss_key *) key;
-    freebn(dss->p);
-    freebn(dss->q);
-    freebn(dss->g);
-    freebn(dss->y);
+    if (dss->p)
+        freebn(dss->p);
+    if (dss->q)
+        freebn(dss->q);
+    if (dss->g)
+        freebn(dss->g);
+    if (dss->y)
+        freebn(dss->y);
+    if (dss->x)
+        freebn(dss->x);
     sfree(dss);
 }