Add another missing bounds check in the SSH-1 private key loader.
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Thu, 11 Jul 2013 17:24:01 +0000 (17:24 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Thu, 11 Jul 2013 17:24:01 +0000 (17:24 +0000)
git-svn-id: svn://svn.tartarus.org/sgt/putty@9904 cda61777-01e9-0310-a592-d414129be87e

sshpubk.c

index bd3c5e4..b860040 100644 (file)
--- a/sshpubk.c
+++ b/sshpubk.c
@@ -74,7 +74,7 @@ static int loadrsakey_main(FILE * fp, struct RSAKey *key, int pub_only,
     /* Next, the comment field. */
     j = GET_32BIT(buf + i);
     i += 4;
-    if (len - i < j)
+    if (j < 0 || len - i < j)
        goto end;
     comment = snewn(j + 1, char);
     if (comment) {