Skip to content

Commit 73f9afc

Browse files
committed
Merge remote-tracking branch 'origin/master' into wl11451-jdbc
2 parents 19fb8fe + bab9b0d commit 73f9afc

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

cdk/foundation/connection_openssl.cc

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ class safe_cert
320320
void connection_TLS_impl::verify_server_cert()
321321
{
322322
safe_cert server_cert;
323-
char *cn= NULL;
323+
const unsigned char *cn= NULL;
324324
int cn_loc= -1;
325325
ASN1_STRING *cn_asn1= NULL;
326326
X509_NAME_ENTRY *cn_entry= NULL;
@@ -374,16 +374,20 @@ void connection_TLS_impl::verify_server_cert()
374374
throw_openssl_error_msg("Failed to get CN from CN entry");
375375
}
376376

377-
cn= (char *) ASN1_STRING_data(cn_asn1);
377+
#if OPENSSL_VERSION_NUMBER > 0x10100000L
378+
cn= ASN1_STRING_get0_data(cn_asn1);
379+
#else
380+
cn= ASN1_STRING_data(cn_asn1);
381+
#endif
378382

379383
// There should not be any NULL embedded in the CN
380-
if ((size_t)ASN1_STRING_length(cn_asn1) != strlen(cn))
384+
if ((size_t)ASN1_STRING_length(cn_asn1) != strlen(reinterpret_cast<const char*>(cn)))
381385
{
382386
throw_openssl_error_msg("NULL embedded in the certificate CN");
383387
}
384388

385389

386-
if (!m_options.verify_cn(cn))
390+
if (!m_options.verify_cn(reinterpret_cast<const char*>(cn)))
387391
{
388392
throw_openssl_error_msg("SSL certificate validation failure");
389393
}

0 commit comments

Comments
 (0)