]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
When manually initialising a 'struct RSAKey' due to loading an SSH1
authorSimon Tatham <anakin@pobox.com>
Tue, 13 Nov 2012 21:34:12 +0000 (21:34 +0000)
committerSimon Tatham <anakin@pobox.com>
Tue, 13 Nov 2012 21:34:12 +0000 (21:34 +0000)
public key but not the private half, NULL out all the CRT-optimisation
fields as well as the private exponent pointer. Otherwise segfaults -
security-harmless, but annoying - can happen in freersakey() when we
notice they aren't null and try to free them.

[originally from svn r9705]

cmdgen.c

index 86a548e3a8926cb92ac65a6b38e041163ec002ef..254ae6a701905b7993cc8a15e24b38e3717d326e 100644 (file)
--- a/cmdgen.c
+++ b/cmdgen.c
@@ -763,6 +763,9 @@ int main(int argc, char **argv)
                }
                ssh1key->comment = dupstr(origcomment);
                ssh1key->private_exponent = NULL;
+               ssh1key->p = NULL;
+               ssh1key->q = NULL;
+               ssh1key->iqmp = NULL;
            } else {
                ret = loadrsakey(infilename, ssh1key, passphrase, &error);
            }