PROTON-1529: Check some return values from openssl
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/31d9942e Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/31d9942e Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/31d9942e Branch: refs/heads/go1 Commit: 31d9942eeef8564124394d16cacf6dc3046aa183 Parents: b79759d Author: Andrew Stitcher <[email protected]> Authored: Wed Jul 26 18:00:24 2017 -0400 Committer: Andrew Stitcher <[email protected]> Committed: Thu Aug 3 12:47:29 2017 -0400 ---------------------------------------------------------------------- proton-c/src/ssl/openssl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/31d9942e/proton-c/src/ssl/openssl.c ---------------------------------------------------------------------- diff --git a/proton-c/src/ssl/openssl.c b/proton-c/src/ssl/openssl.c index 0d7c40b..0b7d157 100644 --- a/proton-c/src/ssl/openssl.c +++ b/proton-c/src/ssl/openssl.c @@ -1330,8 +1330,8 @@ int pn_ssl_get_cert_fingerprint(pn_ssl_t *ssl0, char *fingerprint, size_t finger const EVP_MD *digest = EVP_get_digestbyname(digest_name); pni_ssl_t *ssl = get_ssl_internal(ssl0); - X509 *cert = get_peer_certificate(ssl); + if (!cert) return PN_ERR; if(cert) { unsigned int len; @@ -1392,6 +1392,7 @@ const char* pn_ssl_get_remote_subject_subfield(pn_ssl_t *ssl0, pn_ssl_cert_subje pni_ssl_t *ssl = get_ssl_internal(ssl0); X509 *cert = get_peer_certificate(ssl); + if (!cert) return NULL; X509_NAME *subject_name = X509_get_subject_name(cert); --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
