summaryrefslogtreecommitdiffstats
path: root/usr.sbin/arp/arp.c
diff options
context:
space:
mode:
authorbluhm <bluhm@openbsd.org>2019-08-31 13:46:14 +0000
committerbluhm <bluhm@openbsd.org>2019-08-31 13:46:14 +0000
commitfd4782b86bd7366fa32b3c8cd33e177260048709 (patch)
treeaf6086e81bcbce51069f36342f1f38838a19f6c1 /usr.sbin/arp/arp.c
parentNew utility function mbtowc_left() because this functionality - (diff)
downloadwireguard-openbsd-fd4782b86bd7366fa32b3c8cd33e177260048709.tar.xz
wireguard-openbsd-fd4782b86bd7366fa32b3c8cd33e177260048709.zip
The algorithm creating the routing addresses in route(8) and arp(6)
were still not correct. While the values written to the kernel are fine, the bytes for padding were taken from memory after the sockaddr structs. In route(8) the union of sockaddrs can be made larger, so that the padding is taken from there. In arp(8) the size of the struct is known. Copy only the struct and advance over the padding. The memory has been zeroed before. Merge all address size fixes from arp(8) into ndp(8). OK claudio@
Diffstat (limited to 'usr.sbin/arp/arp.c')
-rw-r--r--usr.sbin/arp/arp.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/usr.sbin/arp/arp.c b/usr.sbin/arp/arp.c
index 21524c1e1cd..6bdee91552a 100644
--- a/usr.sbin/arp/arp.c
+++ b/usr.sbin/arp/arp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: arp.c,v 1.85 2019/08/29 19:11:15 bluhm Exp $ */
+/* $OpenBSD: arp.c,v 1.86 2019/08/31 13:46:14 bluhm Exp $ */
/* $NetBSD: arp.c,v 1.12 1995/04/24 13:25:18 cgd Exp $ */
/*
@@ -675,9 +675,8 @@ rtmsg(int cmd)
#define NEXTADDR(w, s) \
if (rtm->rtm_addrs & (w)) { \
- l = ROUNDUP(((struct sockaddr *)&(s))->sa_len); \
- memcpy(cp, &(s), l); \
- cp += l; \
+ memcpy(cp, &(s), sizeof(s)); \
+ ADVANCE(cp, (struct sockaddr *)&(s)); \
}
NEXTADDR(RTA_DST, sin_m);