summaryrefslogtreecommitdiffstats
path: root/src/privsep-root.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2020-06-01 13:57:31 +0100
committerRoy Marples <roy@marples.name>2020-06-01 13:57:31 +0100
commit191c15140c9343143f91b5c10853f685f0cdc90d (patch)
treee80ebe0f2a7970c3054a70c2906d682d28ec2c26 /src/privsep-root.c
parent80ecaa1cb50bb8508ec44a4b8a9b29c19218892e (diff)
downloaddhcpcd-191c15140c9343143f91b5c10853f685f0cdc90d.tar.xz
privsep: Don't carry ifa_next
While harmless, it's also meaningless.
Diffstat (limited to 'src/privsep-root.c')
-rw-r--r--src/privsep-root.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/privsep-root.c b/src/privsep-root.c
index affcf3c6..942fdd84 100644
--- a/src/privsep-root.c
+++ b/src/privsep-root.c
@@ -336,11 +336,11 @@ ps_root_dowritefile(const struct dhcpcd_ctx *ctx,
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 @@ ps_root_dogetifaddrs(void **rdata, size_t *rlen)
*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);