]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fix crash when allocating UDP socket fails on OpenBSD
authorOndřej Surý <ondrej@sury.org>
Wed, 5 May 2021 19:21:02 +0000 (21:21 +0200)
committerEvan Hunt <each@isc.org>
Fri, 7 May 2021 21:28:30 +0000 (14:28 -0700)
When socket() call fails, the UDP connect code would call the connectcb
with empty req->handle.  This has been fixed.

lib/isc/netmgr/udp.c

index ef404d93da9a4150f7f380aa20c9eb7f5ab81d5d..221da22663374c6d4a5d333475d8a108c3aeb2cb 100644 (file)
@@ -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) {