From d5132d33b8c0dfe28bb07fc29a9d71ee3e6193f4 Mon Sep 17 00:00:00 2001 From: Randall Meyer Date: Thu, 9 Jul 2020 15:16:34 -0700 Subject: [PATCH] Adds null check This attempts to fix null pointer access introduced in 3ffd8acf0b5f3f6258270d8ffea1c28d9f412d9c --- proxy/http/HttpSM.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc index ff3937b4f22..143527a9a4d 100644 --- a/proxy/http/HttpSM.cc +++ b/proxy/http/HttpSM.cc @@ -1856,10 +1856,13 @@ HttpSM::state_http_server_open(int event, void *data) case VC_EVENT_ACTIVE_TIMEOUT: case VC_EVENT_ERROR: case NET_EVENT_OPEN_FAILED: { - NetVConnection *vc = server_session->get_netvc(); - if (vc) { - server_connection_provided_cert = vc->provided_cert(); + if (server_session) { + NetVConnection *vc = server_session->get_netvc(); + if (vc) { + server_connection_provided_cert = vc->provided_cert(); + } } + t_state.current.state = HttpTransact::CONNECTION_ERROR; // save the errno from the connect fail for future use (passed as negative value, flip back) t_state.current.server->set_connect_fail(event == NET_EVENT_OPEN_FAILED ? -reinterpret_cast(data) : ECONNABORTED);