Skip to content

Commit c4e9618

Browse files
maskitbrbzull0
andauthored
Fix nullptr dereference on QUIC connection (#9642)
* Fix nullptr dereference on QUIC connection * Add validation for null before calling the TLSCertSwitchSupport --------- Co-authored-by: Damian Meden <dmeden@apache.org>
1 parent 1756f9d commit c4e9618

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

iocore/net/SSLUtils.cc

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -375,13 +375,15 @@ ssl_cert_callback(SSL *ssl, void *arg)
375375
int retval = 1;
376376

377377
// If we are in tunnel mode, don't select a cert. Pause!
378-
NetVConnection *netvc = reinterpret_cast<NetVConnection *>(sslnetvc);
379-
if (HttpProxyPort::TRANSPORT_BLIND_TUNNEL == netvc->attributes) {
378+
if (sslnetvc) {
379+
NetVConnection *netvc = reinterpret_cast<NetVConnection *>(sslnetvc);
380+
if (HttpProxyPort::TRANSPORT_BLIND_TUNNEL == netvc->attributes) {
380381
#ifdef OPENSSL_IS_BORINGSSL
381-
return -2; // Retry
382+
return -2; // Retry
382383
#else
383-
return -1; // Pause
384+
return -1; // Pause
384385
#endif
386+
}
385387
}
386388

387389
SSLCertContextType ctxType = SSLCertContextType::GENERIC;
@@ -411,7 +413,7 @@ ssl_cert_callback(SSL *ssl, void *arg)
411413
retval = -1; // Pause
412414
}
413415
} else {
414-
if (tcss->selectCertificate(ssl, ctxType) == 1) {
416+
if (tcss && tcss->selectCertificate(ssl, ctxType) == 1) {
415417
retval = 1;
416418
} else {
417419
retval = 0;

0 commit comments

Comments
 (0)