changeset 4572:e438211a2b44 draft

Linux: Work around a coverity issue sa points to a struct sockaddr inside a union where the biggest member os sockaddr_in6. We cast sa to char *, and then write to the address offset directly which will go beyond a sockaddr if we're writing a sockaddr_in6 - but this is fine, the union caters for it.
author Roy Marples <roy@marples.name>
date Tue, 23 Jul 2019 15:27:48 +0100
parents 727f73f1ffab
children 43b72bed75f5
files src/if-linux.c
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/if-linux.c	Tue Jul 23 14:56:49 2019 +0100
+++ b/src/if-linux.c	Tue Jul 23 15:27:48 2019 +0100
@@ -494,6 +494,8 @@
 
 			sa->sa_family = rtm->rtm_family;
 			salen = sa_addrlen(sa);
+			/* sa is a union where sockaddr_in6 is the biggest. */
+			/* coverity[overrun-buffer-arg] */
 			memcpy((char *)sa + sa_addroffset(sa), RTA_DATA(rta),
 			    MIN(salen, RTA_PAYLOAD(rta)));
 		}