maskit commented on code in PR #13584:
URL: https://github.com/apache/trafficserver/pull/13584#discussion_r3873754647
##########
src/api/InkAPI.cc:
##########
@@ -8316,17 +8316,38 @@ TSSslServerCertUpdate(const char *cert_path, const char
*key_path)
return TS_ERROR;
}
- // Extract common name
- const int pos =
X509_NAME_get_index_by_NID(X509_get_subject_name(cert.get()), NID_commonName,
-1);
- const X509_NAME_ENTRY *common_name =
X509_NAME_get_entry(X509_get_subject_name(cert.get()), pos);
+ // Extract common name. X509_NAME_get_index_by_NID() returns -1 when the
+ // certificate has no commonName, and ASN1_STRING_get0_data() does not
+ // guarantee NUL termination. Check both conditions before using the data.
+ const X509_NAME *subject = X509_get_subject_name(cert.get());
Review Comment:
The type probably has to be `auto` to deal with OpenSSL API signature
difference.
--
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]