From: Ondřej Surý Date: Wed, 5 May 2021 19:21:02 +0000 (+0200) Subject: Fix crash when allocating UDP socket fails on OpenBSD X-Git-Tag: v9.17.13~8^2~7 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=29a208aaf7998ea337ce5586c516bf9d0735d2b2;p=thirdparty%2Fbind9.git Fix crash when allocating UDP socket fails on OpenBSD When socket() call fails, the UDP connect code would call the connectcb with empty req->handle. This has been fixed. --- diff --git a/lib/isc/netmgr/udp.c b/lib/isc/netmgr/udp.c index ef404d93da9..221da226633 100644 --- a/lib/isc/netmgr/udp.c +++ b/lib/isc/netmgr/udp.c @@ -690,7 +690,6 @@ isc__nm_async_udpconnect(isc__networker_t *worker, isc__netievent_t *ev0) { REQUIRE(sock->parent == NULL); REQUIRE(sock->tid == isc_nm_tid()); - req->handle = isc__nmhandle_get(sock, &req->peer, &sock->iface->addr); result = udp_connect_direct(sock, req); if (result != ISC_R_SUCCESS) { atomic_store(&sock->active, false); @@ -742,6 +741,7 @@ isc_nm_udpconnect(isc_nm_t *mgr, isc_nmiface_t *local, isc_nmiface_t *peer, req->cbarg = cbarg; req->peer = peer->addr; req->local = local->addr; + req->handle = isc__nmhandle_get(sock, &req->peer, &sock->iface->addr); result = isc__nm_socket(sa_family, SOCK_DGRAM, 0, &sock->fd); if (result != ISC_R_SUCCESS) {