From 0754def85dd22eec95202065cf67a76f4feb4dd4 Mon Sep 17 00:00:00 2001 From: Artem Boldariev Date: Fri, 24 Jun 2022 15:49:15 +0300 Subject: [PATCH] TLS: sometimes TCP conn. handle might be NULL on when connecting In some cases - in particular, in case of errors, NULL might be passed to a connection callback instead of a handle that could have led to an abort. This commit ensures that such a situation will not occur. The issue was found when working on the loopmgr branch. (cherry picked from commit ac4fb34f18978d95e100e4218880dce834950a42) --- lib/isc/netmgr/tlsstream.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/isc/netmgr/tlsstream.c b/lib/isc/netmgr/tlsstream.c index d404ee2965..8753dcae9d 100644 --- a/lib/isc/netmgr/tlsstream.c +++ b/lib/isc/netmgr/tlsstream.c @@ -957,13 +957,14 @@ tcp_connected(isc_nmhandle_t *handle, isc_result_t result, void *cbarg) { isc_nmhandle_t *tlshandle = NULL; REQUIRE(VALID_NMSOCK(tlssock)); - REQUIRE(VALID_NMHANDLE(handle)); tlssock->tid = isc_nm_tid(); if (result != ISC_R_SUCCESS) { goto error; } + INSIST(VALID_NMHANDLE(handle)); + tlssock->iface = handle->sock->iface; tlssock->peer = handle->sock->peer; if (isc__nm_closing(tlssock)) {