mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-28 14:23:30 +01:00
Do not leak a reference to "slot" when decoding private key.
This commit is contained in:
parent
36f3bdac03
commit
f46a7eafb8
@ -683,6 +683,9 @@ crypto_pk_asn1_decode_private(const char *str, size_t len)
|
||||
{
|
||||
tor_assert(str);
|
||||
tor_assert(len < INT_MAX);
|
||||
PK11SlotInfo *slot = PK11_GetBestSlot(CKM_RSA_PKCS, NULL);
|
||||
if (!slot)
|
||||
return NULL;
|
||||
|
||||
SECKEYPrivateKeyInfo info = {
|
||||
.algorithm = {
|
||||
@ -699,7 +702,6 @@ crypto_pk_asn1_decode_private(const char *str, size_t len)
|
||||
}
|
||||
};
|
||||
|
||||
PK11SlotInfo *slot = PK11_GetBestSlot(CKM_RSA_PKCS, NULL);
|
||||
SECStatus s;
|
||||
SECKEYPrivateKey *seckey = NULL;
|
||||
|
||||
@ -722,5 +724,8 @@ crypto_pk_asn1_decode_private(const char *str, size_t len)
|
||||
crypto_nss_log_errors(LOG_WARN, "decoding an RSA private key");
|
||||
}
|
||||
|
||||
if (slot)
|
||||
PK11_FreeSlot(slot);
|
||||
|
||||
return output;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user