mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 17:38:00 +00:00
Spot when we didn't successfully create an RSA public key from a
public blob, and return a proper error in that situation rather than a struct with unhelpful NULLs in. [originally from svn r9991]
This commit is contained in:
parent
cb1df53360
commit
20aabc3059
7
sshrsa.c
7
sshrsa.c
@ -561,6 +561,8 @@ static Bignum getmp(char **data, int *datalen)
|
||||
return b;
|
||||
}
|
||||
|
||||
static void rsa2_freekey(void *key); /* forward reference */
|
||||
|
||||
static void *rsa2_newkey(char *data, int len)
|
||||
{
|
||||
char *p;
|
||||
@ -580,6 +582,11 @@ static void *rsa2_newkey(char *data, int len)
|
||||
rsa->p = rsa->q = rsa->iqmp = NULL;
|
||||
rsa->comment = NULL;
|
||||
|
||||
if (!rsa->exponent || !rsa->modulus) {
|
||||
rsa2_freekey(rsa);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return rsa;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user