diff options
author | Bret Lambert <blambert@cvs.openbsd.org> | 2013-09-11 14:58:02 +0000 |
---|---|---|
committer | Bret Lambert <blambert@cvs.openbsd.org> | 2013-09-11 14:58:02 +0000 |
commit | 609035c3afb38a811b441e9b37cb0355d28251bd (patch) | |
tree | 8366b019052beff1ff6d995d9ff40f413152787d /usr.sbin/snmpd | |
parent | 795ca72a813217b537a4896f4c912f3ff3dbab82 (diff) |
According to ITU X.690 (ASN.1 definition document), "octet strings"
and derived types are allowed to have 0 content octets, whereas
"bitstrings" are required to have at least 1 content octet. Adjust
the checks in the trap acceptance code to allow for 0-length "octet
strings" in SNMP traps.
okay reyk@
Diffstat (limited to 'usr.sbin/snmpd')
-rw-r--r-- | usr.sbin/snmpd/trap.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.sbin/snmpd/trap.c b/usr.sbin/snmpd/trap.c index 705677e303f..77f432a422a 100644 --- a/usr.sbin/snmpd/trap.c +++ b/usr.sbin/snmpd/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.17 2012/09/17 16:43:59 reyk Exp $ */ +/* $OpenBSD: trap.c,v 1.18 2013/09/11 14:58:01 blambert Exp $ */ /* * Copyright (c) 2008 Reyk Floeter <reyk@openbsd.org> @@ -107,10 +107,12 @@ trap_imsg(struct imsgev *iev, pid_t pid) a = ber_add_oidstring(a, ostr); break; case SNMP_BITSTRING: + if (sm->snmp_len < 1) + goto imsgdone; + /* FALLTHROUGH */ case SNMP_OCTETSTRING: case SNMP_IPADDR: - if ((sm->snmp_len < 1) || - (sm->snmp_len >= SNMPD_MAXSTRLEN)) + if (sm->snmp_len >= SNMPD_MAXSTRLEN) goto imsgdone; c = (u_int8_t *)(sm + 1); if (sm->snmp_type == SNMP_BITSTRING) |