X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/putty/blobdiff_plain/4fba1c1f510d22a19b075195c8943cd933419f4e..56668e6dca80813a2c9f03d4c02ed20e22f1061b:/sshpubk.c?ds=sidebyside diff --git a/sshpubk.c b/sshpubk.c index bd3c5e47..b860040d 100644 --- 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) {