]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Initialize struct sockaddr_nl sa 11639/head
authorAram Sargsyan <aram@isc.org>
Wed, 22 Jul 2026 15:48:42 +0000 (15:48 +0000)
committerMartin Basti <mbasti@isc.org>
Thu, 13 Aug 2026 09:47:36 +0000 (11:47 +0200)
The structure is initialized, which can cause problems e.g. with
its nl_pid member.

To quote from an LLM report in GL#6257:

> A non-zero nl_pid is an explicit netlink port-ID request, so the
> kernel either binds the socket to an arbitrary port ID (functionally
> tolerable for a multicast-only listener, but it can squat another
> process's natural port ID) or fails with EADDRINUSE when the garbage
> value collides with an existing NETLINK_ROUTE socket in the same
> namespace.

Zero initialize the structure.

lib/isc/netmgr/udp.c

index 6f544e0d7d117fba7259ad0d9558bffe2d643af1..02402e640c1d3bbdde1549bca4e844aa2d1cc4a1 100644 (file)
@@ -372,7 +372,7 @@ static isc_result_t
 route_socket(uv_os_sock_t *fdp) {
        uv_os_sock_t fd = -1;
 #ifdef USE_NETLINK
-       struct sockaddr_nl sa;
+       struct sockaddr_nl sa = { 0 };
        int r;
 #endif