]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
TLS Stream: handle successful TLS handshake after listener shutdown
authorArtem Boldariev <artem@boldariev.com>
Tue, 18 Oct 2022 11:42:10 +0000 (14:42 +0300)
committerArtem Boldariev <artem@boldariev.com>
Tue, 18 Oct 2022 15:30:24 +0000 (18:30 +0300)
It was possible that accept callback can be called after listener
shutdown. In such a case the callback pointer equals NULL, leading to
segmentation fault. This commit fixes that.

lib/isc/netmgr/tlsstream.c

index d99e842ca34308b9763449351cf9d53e6e3fa041..35fa09fec2c8a531a759896738ecac68bdc14c63 100644 (file)
@@ -341,7 +341,7 @@ tls_try_handshake(isc_nmsocket_t *sock, isc_result_t *presult) {
                isc__nmsocket_log_tls_session_reuse(sock, sock->tlsstream.tls);
                tlshandle = isc__nmhandle_get(sock, &sock->peer, &sock->iface);
                if (sock->tlsstream.server) {
-                       if (sock->listener->accept_cb == NULL) {
+                       if (isc__nmsocket_closing(sock->listener)) {
                                result = ISC_R_CANCELED;
                        } else {
                                result = sock->listener->accept_cb(