summaryrefslogtreecommitdiff
path: root/usr.sbin/snmpd/snmpe.c
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2008-12-05 12:34:02 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2008-12-05 12:34:02 +0000
commite132076bd614aae08b0e4affe59c25432a411f72 (patch)
tree51b21bfc38769dc3bde4a00ab66f18f9f20e8a05 /usr.sbin/snmpd/snmpe.c
parent36910e292f637e56335a5685617b34d3bf900a29 (diff)
fix a possible crash in debugging mode (if compiled for with -DDEBUG)
found by Alexander Sabourenkov
Diffstat (limited to 'usr.sbin/snmpd/snmpe.c')
-rw-r--r--usr.sbin/snmpd/snmpe.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.sbin/snmpd/snmpe.c b/usr.sbin/snmpd/snmpe.c
index 62623104f70..8ffb32b5575 100644
--- a/usr.sbin/snmpd/snmpe.c
+++ b/usr.sbin/snmpd/snmpe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: snmpe.c,v 1.21 2008/09/26 15:19:55 reyk Exp $ */
+/* $OpenBSD: snmpe.c,v 1.22 2008/12/05 12:34:01 reyk Exp $ */
/*
* Copyright (c) 2007, 2008 Reyk Floeter <reyk@vantronix.net>
@@ -430,7 +430,8 @@ snmpe_debug_elements(struct ber_element *root)
fprintf(stderr, "addr %s\n",
inet_ntoa(*(struct in_addr *)buf));
} else
- fprintf(stderr, "string \"%s\"\n", buf);
+ fprintf(stderr, "string \"%s\"\n",
+ root->be_len ? buf : "");
break;
case BER_TYPE_NULL: /* no payload */
case BER_TYPE_EOC: