mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-03-22 14:39:24 -05: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;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void rsa2_freekey(void *key); /* forward reference */
|
||||||
|
|
||||||
static void *rsa2_newkey(char *data, int len)
|
static void *rsa2_newkey(char *data, int len)
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
@ -580,6 +582,11 @@ static void *rsa2_newkey(char *data, int len)
|
|||||||
rsa->p = rsa->q = rsa->iqmp = NULL;
|
rsa->p = rsa->q = rsa->iqmp = NULL;
|
||||||
rsa->comment = NULL;
|
rsa->comment = NULL;
|
||||||
|
|
||||||
|
if (!rsa->exponent || !rsa->modulus) {
|
||||||
|
rsa2_freekey(rsa);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return rsa;
|
return rsa;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user