From a475c87faf653dda847595d1e1c1d50df2754d83 Mon Sep 17 00:00:00 2001 From: Tristan Matthews <tristan.matthews@savoirfairelinux.com> Date: Tue, 8 Apr 2014 15:31:52 -0400 Subject: [PATCH] tls: fix impossible conditional hostname.c_str() can never == 0 Refs #44716 --- daemon/src/sip/security_evaluator.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/daemon/src/sip/security_evaluator.cpp b/daemon/src/sip/security_evaluator.cpp index 7524208b1e..ea55f51654 100644 --- a/daemon/src/sip/security_evaluator.cpp +++ b/daemon/src/sip/security_evaluator.cpp @@ -196,15 +196,13 @@ bool SecurityEvaluator::verifyHostnameCertificate(const std::string& certificate SecurityEvaluator::HostnameValidationResult SecurityEvaluator::validateHostname(const std::string& hostname, const X509 *server_cert) { - HostnameValidationResult result; - - if (hostname.c_str() == nullptr || (server_cert == nullptr)) { - DEBUG("hostname.c_str() == nullptr || (server_cert == nullptr)"); + if (hostname.empty() or server_cert == nullptr) { + DEBUG("hostname empty or server_cert is NULL"); return Error; } // First try the Subject Alternative Names extension - result = matchSubjectAltName(hostname, server_cert); + HostnameValidationResult result = matchSubjectAltName(hostname, server_cert); if (result == NoSANPresent) { // Extension was not found: try the Common Name result = matchCommonName(hostname, server_cert); -- GitLab