diff options
author | Patrick Kelsey <pkelsey@FreeBSD.org> | 2017-04-16 19:17:10 +0000 |
---|---|---|
committer | Patrick Kelsey <pkelsey@FreeBSD.org> | 2017-04-16 19:17:10 +0000 |
commit | 2f8c6c0a587f7b9276ffeb1713f063026cfc9093 (patch) | |
tree | dc6ff3b2220f19ee8bc75d89795c29e154342212 /usr.sbin/ndp | |
parent | c48dc2a193b9befceda8dfc6f894d73251cc00a4 (diff) | |
download | src-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.c | 3 |
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)); |