]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Jacob's last-minute testing found a couple of trivial bugs in
authorSimon Tatham <anakin@pobox.com>
Wed, 11 Feb 2004 13:58:27 +0000 (13:58 +0000)
committerSimon Tatham <anakin@pobox.com>
Wed, 11 Feb 2004 13:58:27 +0000 (13:58 +0000)
import.c, and my attempts to reproduce them in cmdgen found another
one there :-)

[originally from svn r3847]

cmdgen.c
import.c

index 2f0fdc1dafbd392fd734033afbb3a1ca314d1718..a5fccb0773f2b3b6113200f1fbb72f9ae1dd4287 100644 (file)
--- a/cmdgen.c
+++ b/cmdgen.c
@@ -730,7 +730,7 @@ int main(int argc, char **argv)
          case SSH_KEYTYPE_OPENSSH:
          case SSH_KEYTYPE_SSHCOM:
            ssh2key = import_ssh2(&infilename, intype, passphrase);
-           if (ssh2key)
+           if (ssh2key && ssh2key != SSH2_WRONG_PASSPHRASE)
                error = NULL;
            else if (!error) {
                if (ssh2key == SSH2_WRONG_PASSPHRASE)
index c43eca404d0d2d8f05d3d5d6df35305e3633169a..d1ab75114c5cb7eba8989ec74f0f5cdaa0d7c521 100644 (file)
--- a/import.c
+++ b/import.c
@@ -582,6 +582,7 @@ struct ssh2_userkey *openssh_read(const Filename *filename, char *passphrase)
        if (ret < 0 || id != 2 ||
            key->keyblob+key->keyblob_len-p < len) {
            errmsg = "ASN.1 decoding failure";
+           retval = SSH2_WRONG_PASSPHRASE;
            goto error;
        }
 
@@ -1323,7 +1324,7 @@ struct ssh2_userkey *sshcom_read(const Filename *filename, char *passphrase)
      * Strip away the containing string to get to the real meat.
      */
     len = GET_32BIT(ciphertext);
-    if (len > cipherlen-4) {
+    if (len < 0 || len > cipherlen-4) {
         errmsg = "containing string was ill-formed";
         goto error;
     }