зеркало из https://github.com/github/putty.git
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:
Родитель
cb1df53360
Коммит
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;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче