summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2009-06-17 15:31:24 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2009-06-17 15:31:24 +0000
commit3d6ef233ef24e57be4aab741699e91ab79d9eeb4 (patch)
tree9b4c3ea0a7810c4c416f394daf30ac70435f3cc7
parent54d1ac96e22c710154e3d0392706564a022ecaf7 (diff)
Check for the correct RTM_VERSION before accessing anything in the rt message.
Fixes a SIGBUS seen on alpha by naddy@. OK naddy@, deraadt@
-rw-r--r--usr.sbin/ndp/ndp.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.sbin/ndp/ndp.c b/usr.sbin/ndp/ndp.c
index bbe30506ee4..e77c5194803 100644
--- a/usr.sbin/ndp/ndp.c
+++ b/usr.sbin/ndp/ndp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ndp.c,v 1.43 2009/06/05 22:40:24 chris Exp $ */
+/* $OpenBSD: ndp.c,v 1.44 2009/06/17 15:31:23 claudio Exp $ */
/* $KAME: ndp.c,v 1.101 2002/07/17 08:46:33 itojun Exp $ */
/*
@@ -607,6 +607,8 @@ again:;
int isrouter = 0, prbs = 0;
rtm = (struct rt_msghdr *)next;
+ if (rtm->rtm_version != RTM_VERSION)
+ continue;
sin = (struct sockaddr_in6 *)(next + rtm->rtm_hdrlen);
sdl = (struct sockaddr_dl *)((char *)sin + ROUNDUP(sin->sin6_len));