diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2007-07-21 15:43:02 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2007-07-21 15:43:02 +0000 |
commit | 01f08b75b1fdf6702226cea2682a7dd9a1c706a7 (patch) | |
tree | 900928ce57774348872e7d3c31390eacda94faea | |
parent | 8182ab93829023bf9ec5c69143e03269b52797b3 (diff) |
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-- | sbin/route/show.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sbin/route/show.c b/sbin/route/show.c index 9b78ce764a7..ca431f4a7b0 100644 --- a/sbin/route/show.c +++ b/sbin/route/show.c @@ -1,4 +1,4 @@ -/* $OpenBSD: show.c,v 1.58 2007/06/04 12:23:44 henning Exp $ */ +/* $OpenBSD: show.c,v 1.59 2007/07/21 15:43:01 claudio Exp $ */ /* $NetBSD: show.c,v 1.1 1996/11/15 18:01:41 gwr Exp $ */ /* @@ -149,6 +149,8 @@ p_rttables(int af, u_int tableid) 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; |