summaryrefslogtreecommitdiff
path: root/usr.sbin/arp
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2019-08-31 13:46:15 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2019-08-31 13:46:15 +0000
commit5570f58b2c83bdae25a6971746eb7e6bc669f58c (patch)
tree1a1dd34a999a016a311358ba2c340ce6a0d8579f /usr.sbin/arp
parentc11d303f41f15a1a25dbf1ffcbebf91b86ef9556 (diff)
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')
-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);