diff options
author | Marco Pfatschbacher <mpf@cvs.openbsd.org> | 2008-09-19 08:52:17 +0000 |
---|---|---|
committer | Marco Pfatschbacher <mpf@cvs.openbsd.org> | 2008-09-19 08:52:17 +0000 |
commit | 40613fd0d0c295f5f6801b0a1618a27cb91daf1a (patch) | |
tree | 633fd029dccfc66c08ad988e454053f5420253be /usr.sbin | |
parent | 6128d4a04b324850e090a73ad670e98626b22f0e (diff) |
Merge printb() fix from ifconfig.c -r 1.157:
Don't increment a pointer *before* testing it for NULL.
OK canacar@
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/tcpdump/util.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.sbin/tcpdump/util.c b/usr.sbin/tcpdump/util.c index f8d9f8cf97f..d103c04193e 100644 --- a/usr.sbin/tcpdump/util.c +++ b/usr.sbin/tcpdump/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.23 2007/10/07 16:41:05 deraadt Exp $ */ +/* $OpenBSD: util.c,v 1.24 2008/09/19 08:52:16 mpf Exp $ */ /* * Copyright (c) 1990, 1991, 1993, 1994, 1995, 1996, 1997 @@ -23,7 +23,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Id: util.c,v 1.23 2007/10/07 16:41:05 deraadt Exp $ (LBL)"; + "@(#) $Id: util.c,v 1.24 2008/09/19 08:52:16 mpf Exp $ (LBL)"; #endif #include <sys/types.h> @@ -337,8 +337,9 @@ printb(char *s, unsigned short v, char *bits) printf("%s=%o", s, v); else printf("%s=%x", s, v); - bits++; + if (bits) { + bits++; putchar('<'); while ((i = *bits++)) { if (v & (1 << (i-1))) { |