Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1053,7 +1053,13 @@ int32_t CryptoNative_SslAddExtraChainCert(SSL* ssl, X509* x509)
return 0;
}

if (SSL_ctrl(ssl, SSL_CTRL_CHAIN_CERT, 1,(void*)x509) == 1)
// larg must be 0 (SSL_add0_chain_cert), not 1 (SSL_add1_chain_cert). The caller,
// Interop.Ssl.AddExtraChainCertificates, up-refs and then calls SetHandleAsInvalid to
// hand its reference over, which is the add0 contract and matches
// CryptoNative_SslCtxAddExtraChainCert above. With add1 libssl takes a reference of its
// own and the caller's is abandoned rather than released, leaking one X509 per
// intermediate per SSL handle.
if (SSL_ctrl(ssl, SSL_CTRL_CHAIN_CERT, 0,(void*)x509) == 1)
{
return 1;
}
Expand Down
Loading