]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Linux: Mark another coverity false positive.
authorRoy Marples <roy@marples.name>
Tue, 23 Jul 2019 15:11:18 +0000 (16:11 +0100)
committerRoy Marples <roy@marples.name>
Tue, 23 Jul 2019 15:11:18 +0000 (16:11 +0100)
src/if-linux.c

index e3a7947368b2dc673ef3a7226fb666abd4b8eb11..3919bff5f0716b4a5d1ab204dff25ef894568376 100644 (file)
@@ -1263,10 +1263,16 @@ if_route(unsigned char cmd, const struct rt *rt)
            (const char *)(sa) + sa_addroffset((sa)),                   \
            (unsigned short)sa_addrlen((sa)));
        nlm.rt.rtm_dst_len = (unsigned char)sa_toprefix(&rt->rt_netmask);
+       /* rt->rt_dest and rt->gateway are unions where sockaddr_in6
+        * is the biggest member. However, we access them as the
+        * generic sockaddr and coverity thinks this will overrun. */
+       /* coverity[overrun-buffer-arg] */
        ADDSA(RTA_DST, &rt->rt_dest);
        if (cmd == RTM_ADD || cmd == RTM_CHANGE) {
-               if (!gateway_unspec)
+               if (!gateway_unspec) {
+                       /* coverity[overrun-buffer-arg] */
                        ADDSA(RTA_GATEWAY, &rt->rt_gateway);
+               }
                /* Cannot add tentative source addresses.
                 * We don't know this here, so just skip INET6 ifa's.*/
                if (!sa_is_unspecified(&rt->rt_ifa) &&