summaryrefslogtreecommitdiff
path: root/src/LibsslTLSSession.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/LibsslTLSSession.cc')
-rw-r--r--src/LibsslTLSSession.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/LibsslTLSSession.cc b/src/LibsslTLSSession.cc
index 16d1bf56..1014c3ca 100644
--- a/src/LibsslTLSSession.cc
+++ b/src/LibsslTLSSession.cc
@@ -259,6 +259,15 @@ int OpenSSLTLSSession::tlsConnect(const std::string& hostname,
continue;
}
size_t len = ASN1_STRING_length(altName->d.ia5);
+ if (len == 0) {
+ continue;
+ }
+ if (name[len - 1] == '.') {
+ --len;
+ if (len == 0) {
+ continue;
+ }
+ }
dnsNames.push_back(std::string(name, len));
}
else if (altName->type == GEN_IPADD) {
@@ -290,6 +299,17 @@ int OpenSSLTLSSession::tlsConnect(const std::string& hostname,
if (outlen < 0) {
continue;
}
+ if (outlen == 0) {
+ OPENSSL_free(out);
+ continue;
+ }
+ if (out[outlen - 1] == '.') {
+ --outlen;
+ if (outlen == 0) {
+ OPENSSL_free(out);
+ continue;
+ }
+ }
commonName.assign(&out[0], &out[outlen]);
OPENSSL_free(out);
break;