changeset 5289:b32000689362 draft

privsep: Don't carry ifa_next While harmless, it's also meaningless.
author Roy Marples <roy@marples.name>
date Mon, 01 Jun 2020 13:57:31 +0100
parents 30958d539e6c
children fae6670fef23
files src/privsep-root.c
diffstat 1 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/privsep-root.c	Sun May 31 21:06:32 2020 +0100
+++ b/src/privsep-root.c	Mon Jun 01 13:57:31 2020 +0100
@@ -336,11 +336,11 @@
 static ssize_t
 ps_root_dogetifaddrs(void **rdata, size_t *rlen)
 {
-	struct ifaddrs *ifaddrs, *ifa;
+	struct ifaddrs *ifaddrs, *ifa, *ifa_next;
 	size_t len;
 	uint8_t *buf, *sap;
 	socklen_t salen;
-	void *ifdata;
+	void *ifa_data;
 
 	if (getifaddrs(&ifaddrs) == -1)
 		return -1;
@@ -380,12 +380,15 @@
 	*rlen = len;
 
 	for (ifa = ifaddrs; ifa != NULL; ifa = ifa->ifa_next) {
-		/* Don't carry ifa_data. */
-		ifdata = ifa->ifa_data;
+		/* Don't carry ifa_data or ifa_next. */
+		ifa_data = ifa->ifa_data;
+		ifa_next = ifa->ifa_next;
 		ifa->ifa_data = NULL;
+		ifa->ifa_next = NULL;
 		memcpy(buf, ifa, sizeof(*ifa));
 		buf += ALIGN(sizeof(*ifa));
-		ifa->ifa_data = ifdata;
+		ifa->ifa_data = ifa_data;
+		ifa->ifa_next = ifa_next;
 
 		strlcpy((char *)buf, ifa->ifa_name, IFNAMSIZ);
 		buf += ALIGN(IFNAMSIZ);