]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
TLS: sometimes TCP conn. handle might be NULL on when connecting
authorArtem Boldariev <artem@boldariev.com>
Fri, 24 Jun 2022 12:49:15 +0000 (15:49 +0300)
committerArtem Boldariev <artem@boldariev.com>
Tue, 12 Jul 2022 11:40:22 +0000 (14:40 +0300)
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.

lib/isc/netmgr/tlsstream.c

index 69b867964b5c94281e8c380a1c61c684aa2e2e48..adde8e069a22eb6bbd8d6785b1a7b775787161df 100644 (file)
@@ -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)) {