changeset 4574:901ff4b0952b draft

Linux: Mark another coverity false positive.
author Roy Marples <roy@marples.name>
date Tue, 23 Jul 2019 16:11:18 +0100
parents 43b72bed75f5
children d0044fa1a6e1
files src/if-linux.c
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/if-linux.c	Tue Jul 23 15:55:27 2019 +0100
+++ b/src/if-linux.c	Tue Jul 23 16:11:18 2019 +0100
@@ -1263,10 +1263,16 @@
 	    (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) &&