diff options
author | Reyk Floeter <reyk@cvs.openbsd.org> | 2008-01-17 22:55:08 +0000 |
---|---|---|
committer | Reyk Floeter <reyk@cvs.openbsd.org> | 2008-01-17 22:55:08 +0000 |
commit | 29e547e6003ad05540e5c055c74d7d9e14bb8d72 (patch) | |
tree | d5680147eeb7118f60977d26cc367ff7df20acb4 /usr.sbin | |
parent | 412a833ae4b380203306f1e314d4ba5b120aebf0 (diff) |
the optional trap varbind elements may be null
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/snmpd/trap.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/usr.sbin/snmpd/trap.c b/usr.sbin/snmpd/trap.c index 7304e140ad1..d9c42c87352 100644 --- a/usr.sbin/snmpd/trap.c +++ b/usr.sbin/snmpd/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.5 2008/01/17 17:35:06 reyk Exp $ */ +/* $OpenBSD: trap.c,v 1.6 2008/01/17 22:55:07 reyk Exp $ */ /* * Copyright (c) 2008 Reyk Floeter <reyk@vantronix.net> @@ -66,7 +66,7 @@ trap_imsg(struct imsgbuf *ibuf, pid_t pid) u_int8_t *c; char ostr[SNMP_MAX_OID_LEN]; struct ber_element *ber = NULL, *varbind = NULL, *a; - size_t len; + size_t len = 0; struct ber_oid o; while (!done) { @@ -181,9 +181,10 @@ trap_imsg(struct imsgbuf *ibuf, pid_t pid) goto done; } - len = ber_calc_len(varbind); - log_debug("trap_imsg: from pid %u, len %d", pid, len); - + if (varbind != NULL) + len = ber_calc_len(varbind); + log_debug("trap_imsg: from pid %u len %d elements %d", + pid, x, len); trap_send(&o, varbind); ret = 0; |