diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2007-07-21 15:43:43 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2007-07-21 15:43:43 +0000 |
commit | 1112e6f370cb399af85f86583abcc55625f0049a (patch) | |
tree | 00536700be5f9b10ee1c5eedfe99f0da2cac504b | |
parent | 01f08b75b1fdf6702226cea2682a7dd9a1c706a7 (diff) |
Similar to sbin/route/show.c:
Check the rtm_version before trying to print an entry. If the rtmsg has a
different version skip it and don't try to print it. Solves a SIGSEGV I have
triggered with one of my scarier diffs. OK henning@
-rw-r--r-- | usr.bin/netstat/show.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.bin/netstat/show.c b/usr.bin/netstat/show.c index cade60368fd..e054bc44b30 100644 --- a/usr.bin/netstat/show.c +++ b/usr.bin/netstat/show.c @@ -1,4 +1,4 @@ -/* $OpenBSD: show.c,v 1.7 2007/06/19 05:37:10 ray Exp $ */ +/* $OpenBSD: show.c,v 1.8 2007/07/21 15:43:42 claudio Exp $ */ /* $NetBSD: show.c,v 1.1 1996/11/15 18:01:41 gwr Exp $ */ /* @@ -142,6 +142,8 @@ p_rttables(int af) if (buf) { for (next = buf; next < lim; next += rtm->rtm_msglen) { rtm = (struct rt_msghdr *)next; + if (rtm->rtm_version != RTM_VERSION) + continue; sa = (struct sockaddr *)(rtm + 1); if (af != AF_UNSPEC && sa->sa_family != af) continue; |