aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/ndp
diff options
context:
space:
mode:
authorPatrick Kelsey <pkelsey@FreeBSD.org>2017-04-16 19:17:10 +0000
committerPatrick Kelsey <pkelsey@FreeBSD.org>2017-04-16 19:17:10 +0000
commit2f8c6c0a587f7b9276ffeb1713f063026cfc9093 (patch)
treedc6ff3b2220f19ee8bc75d89795c29e154342212 /usr.sbin/ndp
parentc48dc2a193b9befceda8dfc6f894d73251cc00a4 (diff)
downloadsrc-2f8c6c0a587f7b9276ffeb1713f063026cfc9093.tar.gz
src-2f8c6c0a587f7b9276ffeb1713f063026cfc9093.zip
Fix userland tools that don't check the format of routing socket
messages before accessing message fields that may not be present, removing dead/duplicate/misleading code along the way. Document the message format for each routing socket message in route.h. Fix a bug in usr.bin/netstat introduced in r287351 that resulted in pointer computation with essentially random 16-bit offsets and dereferencing of the results. Reviewed by: ae MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D10330
Notes
Notes: svn path=/head/; revision=317035
Diffstat (limited to 'usr.sbin/ndp')
-rw-r--r--usr.sbin/ndp/ndp.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/usr.sbin/ndp/ndp.c b/usr.sbin/ndp/ndp.c
index 8a82efc73d17..79aef78b0a64 100644
--- a/usr.sbin/ndp/ndp.c
+++ b/usr.sbin/ndp/ndp.c
@@ -888,7 +888,8 @@ doit:
}
do {
l = read(s, (char *)&m_rtmsg, sizeof(m_rtmsg));
- } while (l > 0 && (rtm->rtm_seq != seq || rtm->rtm_pid != pid));
+ } while (l > 0 && (rtm->rtm_type != cmd || rtm->rtm_seq != seq ||
+ rtm->rtm_pid != pid));
if (l < 0)
(void) fprintf(stderr, "ndp: read from routing socket: %s\n",
strerror(errno));