mirror of
https://github.com/znc/znc.git
synced 2026-08-02 23:12:46 +02:00
Fix use-after-free in znc --makepem
X509_get_subject_name() returns an internal pointer, which was destroyed
by X509_set_subject_name(), and then accessed again in
X509_set_issuer_name().
But X509_set_subject_name() isn't needed at all, because subject name
was modified in place.
(cherry picked from commit 744bd7d55c)
This commit is contained in:
@@ -116,7 +116,6 @@ void CUtils::GenerateCert(FILE *pOut, const CString& sHost) {
|
||||
X509_NAME_add_entry_by_txt(pName, "CN", MBSTRING_ASC, (unsigned char *)pHostName, -1, -1, 0);
|
||||
X509_NAME_add_entry_by_txt(pName, "emailAddress", MBSTRING_ASC, (unsigned char *)sEmailAddr.c_str(), -1, -1, 0);
|
||||
|
||||
X509_set_subject_name(pCert.get(), pName);
|
||||
X509_set_issuer_name(pCert.get(), pName);
|
||||
|
||||
if (!X509_sign(pCert.get(), pKey.get(), EVP_sha256()))
|
||||
|
||||
Reference in New Issue
Block a user