summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2010-01-13 23:49:07 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2010-01-13 23:49:07 +0000
commit88c1df0d61ad8f034c4fec60a06b220b7cafd16a (patch)
tree4b123bd32184d00d71f511e712e48992a88ccd40 /sbin
parente70bd4089785cd464586e18c7f289768679d78e5 (diff)
netmask sockaddrs for the default route may set sa_len to 0 to indicate
a all zero mask. So check for this condition as well since else we read garbage that comes after the netmask sockaddr (which is the IFP normaly). Found by todd@, OK dlg@
Diffstat (limited to 'sbin')
-rw-r--r--sbin/route/show.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sbin/route/show.c b/sbin/route/show.c
index f8b7228178f..e7852de2e83 100644
--- a/sbin/route/show.c
+++ b/sbin/route/show.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: show.c,v 1.82 2010/01/11 08:26:29 dlg Exp $ */
+/* $OpenBSD: show.c,v 1.83 2010/01/13 23:49:06 claudio Exp $ */
/* $NetBSD: show.c,v 1.1 1996/11/15 18:01:41 gwr Exp $ */
/*
@@ -698,7 +698,7 @@ netname4(in_addr_t in, struct sockaddr_in *maskp)
int mbits;
in = ntohl(in);
- mask = maskp ? ntohl(maskp->sin_addr.s_addr) : 0;
+ mask = maskp && maskp->sin_len != 0 ? ntohl(maskp->sin_addr.s_addr) : 0;
if (!nflag && in != INADDR_ANY) {
if ((np = getnetbyaddr(in, AF_INET)) != NULL)
cp = np->n_name;