summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordhill <dhill@openbsd.org>2006-03-20 20:12:45 +0000
committerdhill <dhill@openbsd.org>2006-03-20 20:12:45 +0000
commitfd5fa2e6958f1b86f923cd38360627bf6399b06d (patch)
treef2ac361c673bec09a6ad866c0732128dc26f26e2
parentNetBSD Coverity CID 2302: Free fat if fatal error to avoid leak. (diff)
downloadwireguard-openbsd-fd5fa2e6958f1b86f923cd38360627bf6399b06d.tar.xz
wireguard-openbsd-fd5fa2e6958f1b86f923cd38360627bf6399b06d.zip
Don't increment a pointer *before* testing it for NULL
ok deraadt@
-rw-r--r--sbin/ifconfig/ifconfig.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c
index 72089a68af7..9666cbfd248 100644
--- a/sbin/ifconfig/ifconfig.c
+++ b/sbin/ifconfig/ifconfig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ifconfig.c,v 1.156 2006/01/05 15:00:10 norby Exp $ */
+/* $OpenBSD: ifconfig.c,v 1.157 2006/03/20 20:12:45 dhill Exp $ */
/* $NetBSD: ifconfig.c,v 1.40 1997/10/01 02:19:43 enami Exp $ */
/*
@@ -3434,8 +3434,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))) {
@@ -3461,8 +3462,8 @@ printb_status(unsigned short v, char *bits)
int i, any = 0;
char c;
- bits++;
if (bits) {
+ bits++;
while ((i = *bits++)) {
if (v & (1 << (i-1))) {
if (any)