mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 644070 - nsNSSCertificate::defaultServerNickname leaks in case of server name conflict; r=mayhemer
This commit is contained in:
parent
b5f305985c
commit
ab717a320a
@ -513,21 +513,25 @@ nsCertOverrideService::RememberValidityOverride(const nsACString & aHostName, PR
|
||||
|
||||
CERTCertificateCleaner nsscertCleaner(nsscert);
|
||||
|
||||
nsCAutoString nickname;
|
||||
nickname = nsNSSCertificate::defaultServerNickname(nsscert);
|
||||
if (!aTemporary && !nickname.IsEmpty())
|
||||
char* nickname = nsNSSCertificate::defaultServerNickname(nsscert);
|
||||
if (!aTemporary && nickname && *nickname)
|
||||
{
|
||||
PK11SlotInfo *slot = PK11_GetInternalKeySlot();
|
||||
if (!slot)
|
||||
if (!slot) {
|
||||
PR_Free(nickname);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
SECStatus srv = PK11_ImportCert(slot, nsscert, CK_INVALID_HANDLE,
|
||||
const_cast<char*>(nickname.get()), PR_FALSE);
|
||||
nickname, PR_FALSE);
|
||||
PK11_FreeSlot(slot);
|
||||
|
||||
if (srv != SECSuccess)
|
||||
if (srv != SECSuccess) {
|
||||
PR_Free(nickname);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
PR_FREEIF(nickname);
|
||||
|
||||
nsCAutoString fpStr;
|
||||
nsresult rv = GetCertFingerprintByOidTag(nsscert,
|
||||
|
@ -1099,16 +1099,16 @@ SECStatus PR_CALLBACK AuthCertificateCallback(void* client_data, PRFileDesc* fd,
|
||||
}
|
||||
|
||||
// We have found a signer cert that we want to remember.
|
||||
nsCAutoString nickname;
|
||||
nickname = nsNSSCertificate::defaultServerNickname(node->cert);
|
||||
if (!nickname.IsEmpty()) {
|
||||
char* nickname = nsNSSCertificate::defaultServerNickname(node->cert);
|
||||
if (nickname && *nickname) {
|
||||
PK11SlotInfo *slot = PK11_GetInternalKeySlot();
|
||||
if (slot) {
|
||||
PK11_ImportCert(slot, node->cert, CK_INVALID_HANDLE,
|
||||
const_cast<char*>(nickname.get()), PR_FALSE);
|
||||
nickname, PR_FALSE);
|
||||
PK11_FreeSlot(slot);
|
||||
}
|
||||
}
|
||||
PR_FREEIF(nickname);
|
||||
}
|
||||
|
||||
CERT_DestroyCertList(certList);
|
||||
|
@ -85,6 +85,8 @@ public:
|
||||
static nsNSSCertificate* Create(CERTCertificate *cert = nsnull);
|
||||
static nsNSSCertificate* ConstructFromDER(char *certDER, int derLen);
|
||||
|
||||
// It is the responsibility of the caller of this method to free the returned
|
||||
// string using PR_Free.
|
||||
static char* defaultServerNickname(CERTCertificate* cert);
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user