1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-25 01:02:24 +00:00

Fix memory leak in ed25519_openssh_createkey

If q could not be read from the input blob, the allocated ec_key
structure was not freed.
This commit is contained in:
Tim Kosse 2017-01-23 18:46:42 +01:00 committed by Simon Tatham
parent 4548f22b38
commit e882b49051

View File

@ -2029,10 +2029,10 @@ static void *ed25519_openssh_createkey(const struct ssh_signkey *self,
} }
getstring((const char**)blob, len, &q, &qlen); getstring((const char**)blob, len, &q, &qlen);
if (!q) if (!q || qlen != 64) {
return NULL; ecdsa_freekey(ec);
if (qlen != 64)
return NULL; return NULL;
}
ec->privateKey = bignum_from_bytes_le((const unsigned char *)q, 32); ec->privateKey = bignum_from_bytes_le((const unsigned char *)q, 32);