From: Artem Boldariev Date: Fri, 24 Jun 2022 12:49:15 +0000 (+0300) Subject: TLS: sometimes TCP conn. handle might be NULL on when connecting X-Git-Tag: v9.19.4~40^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ac4fb34f18978d95e100e4218880dce834950a42;p=thirdparty%2Fbind9.git 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. --- diff --git a/lib/isc/netmgr/tlsstream.c b/lib/isc/netmgr/tlsstream.c index 69b867964b5..adde8e069a2 100644 --- a/lib/isc/netmgr/tlsstream.c +++ b/lib/isc/netmgr/tlsstream.c @@ -951,13 +951,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)) {