]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Remove a return path from sshcom_write() which was both unreachable
authorSimon Tatham <anakin@pobox.com>
Sun, 14 Jul 2013 10:46:39 +0000 (10:46 +0000)
committerSimon Tatham <anakin@pobox.com>
Sun, 14 Jul 2013 10:46:39 +0000 (10:46 +0000)
(it would trigger if !type==RSA and !type==DSA, but one of those must
have been true to get there in the first place) and erroneous (it
would return NULL without going through the cleanup code). Since the
code's internal structure guarantees that path isn't reached, replace
it with an assert.

[originally from svn r9924]

import.c

index d4b87bc7354256f149751a83d6565399957effcb..77a32437a25fbc3de6d911c3b49569d73ae48a32 100644 (file)
--- a/import.c
+++ b/import.c
@@ -1473,7 +1473,8 @@ struct ssh2_userkey *sshcom_read(const Filename *filename, char *passphrase,
         pos += put_mp(blob+pos, p.start, p.bytes);
         pos += put_mp(blob+pos, u.start, u.bytes);
         privlen = pos - publen;
-    } else if (type == DSA) {
+    } else {
+        assert(type == DSA); /* the only other option from the if above */
         struct mpint_pos p, q, g, x, y;
         int pos = 4;
         if (GET_32BIT(ciphertext) != 0) {
@@ -1500,8 +1501,7 @@ struct ssh2_userkey *sshcom_read(const Filename *filename, char *passphrase,
         publen = pos;
         pos += put_mp(blob+pos, x.start, x.bytes);
         privlen = pos - publen;
-    } else
-       return NULL;
+    }
 
     assert(privlen > 0);              /* should have bombed by now if not */