Copilot commented on code in PR #13318:
URL: https://github.com/apache/trafficserver/pull/13318#discussion_r3464133755
##########
src/iocore/net/OCSPStapling.cc:
##########
@@ -1435,7 +1437,11 @@ ssl_callback_ocsp_stapling(SSL *ssl, void *)
}
memcpy(p, cinf->resp_der, cinf->resp_derlen);
ink_mutex_release(&cinf->stapling_mutex);
- SSL_set_tlsext_status_ocsp_resp(ssl, p, cinf->resp_derlen);
+ if (SSL_set_tlsext_status_ocsp_resp(ssl, p, cinf->resp_derlen) == 0) {
+ // On success the call takes ownership of p and frees it; on failure it
does not.
+ OPENSSL_free(p);
+ return SSL_TLSEXT_ERR_NOACK;
+ }
Review Comment:
The comment about `SSL_set_tlsext_status_ocsp_resp()` freeing `p` on success
is misleading: the API takes ownership and will free it later (e.g., when
replaced or when the SSL object is freed), not necessarily immediately. This
matters for maintainers reasoning about lifetime/ownership.
##########
src/iocore/net/SSLUtils.cc:
##########
@@ -1167,6 +1167,8 @@ setClientCertCACerts(SSL *ssl, const char *file, const
char *dir)
X509_STORE *ctx = X509_STORE_new();
if (X509_STORE_load_locations(ctx, file && file[0] != '\0' ? file :
nullptr, dir && dir[0] != '\0' ? dir : nullptr)) {
SSL_set0_verify_cert_store(ssl, ctx);
+ } else {
+ X509_STORE_free(ctx);
}
Review Comment:
`X509_STORE_new()` can return `nullptr` on allocation failure; calling
`X509_STORE_load_locations()` with a null store would crash. Since this
function is executed on handshake paths, it's worth making this allocation
failure safe.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]