summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>1998-05-16 08:31:49 +0000
committerache <ache@FreeBSD.org>1998-05-16 08:31:49 +0000
commit1ec8848ea498015b3c28b8f070f920c623d59363 (patch)
tree1cf2746c933d9b77aa2a6faae76ffc32bb14aacc
parent1985adcd4184062fa3a43bfe8275fde93ad335ca (diff)
downloadFreeBSD-src-1ec8848ea498015b3c28b8f070f920c623d59363.zip
FreeBSD-src-1ec8848ea498015b3c28b8f070f920c623d59363.tar.gz
Fix broken sun_len usage: it is not sun_path length but bigger
-rw-r--r--usr.bin/netstat/unix.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/usr.bin/netstat/unix.c b/usr.bin/netstat/unix.c
index 64bdb22..96d6fd7 100644
--- a/usr.bin/netstat/unix.c
+++ b/usr.bin/netstat/unix.c
@@ -36,7 +36,7 @@
static char sccsid[] = "@(#)unix.c 8.1 (Berkeley) 6/6/93";
#endif
static const char rcsid[] =
- "$Id: unix.c,v 1.5 1997/08/25 16:55:00 wollman Exp $";
+ "$Id: unix.c,v 1.6 1998/05/15 20:19:21 wollman Exp $";
#endif /* not lint */
/*
@@ -131,6 +131,7 @@ unixdomainpr(xunp, so)
struct unpcb *unp;
struct sockaddr_un *sa;
static int first = 1;
+#define offsetof(s, e) ((char *)&((s *)0)->e - (char *)((s *)0))
unp = &xunp->xu_unp;
if (unp->unp_addr)
@@ -152,6 +153,8 @@ unixdomainpr(xunp, so)
(long)unp->unp_vnode, (long)unp->unp_conn,
(long)unp->unp_refs.lh_first, (long)unp->unp_reflink.le_next);
if (sa)
- printf(" %.*s", sa->sun_len, sa->sun_path);
+ printf(" %.*s",
+ sa->sun_len - offsetof(struct sockaddr_un, sun_path),
+ sa->sun_path);
putchar('\n');
}
OpenPOWER on IntegriCloud