File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -320,7 +320,7 @@ class safe_cert
320
320
void connection_TLS_impl::verify_server_cert ()
321
321
{
322
322
safe_cert server_cert;
323
- char *cn= NULL ;
323
+ const unsigned char *cn= NULL ;
324
324
int cn_loc= -1 ;
325
325
ASN1_STRING *cn_asn1= NULL ;
326
326
X509_NAME_ENTRY *cn_entry= NULL ;
@@ -374,16 +374,20 @@ void connection_TLS_impl::verify_server_cert()
374
374
throw_openssl_error_msg (" Failed to get CN from CN entry" );
375
375
}
376
376
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
378
382
379
383
// 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) ))
381
385
{
382
386
throw_openssl_error_msg (" NULL embedded in the certificate CN" );
383
387
}
384
388
385
389
386
- if (!m_options.verify_cn (cn ))
390
+ if (!m_options.verify_cn (reinterpret_cast < const char *>(cn) ))
387
391
{
388
392
throw_openssl_error_msg (" SSL certificate validation failure" );
389
393
}
You can’t perform that action at this time.
0 commit comments