summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorblambert <blambert@openbsd.org>2013-10-19 14:18:39 +0000
committerblambert <blambert@openbsd.org>2013-10-19 14:18:39 +0000
commitc38965de0eae7b8aae562f6499653a1269b4bc56 (patch)
tree9e8149269ee305170da11c2fa6efcf83887e1093
parentKeep track of which fds were closed before and only close those still (diff)
downloadwireguard-openbsd-c38965de0eae7b8aae562f6499653a1269b4bc56.tar.xz
wireguard-openbsd-c38965de0eae7b8aae562f6499653a1269b4bc56.zip
Fix receipt of OID varbinds when sending traps
ok reyk@
-rw-r--r--usr.sbin/snmpd/trap.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.sbin/snmpd/trap.c b/usr.sbin/snmpd/trap.c
index 9045c47e763..5c3ca65eecd 100644
--- a/usr.sbin/snmpd/trap.c
+++ b/usr.sbin/snmpd/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.20 2013/10/01 12:41:48 reyk Exp $ */
+/* $OpenBSD: trap.c,v 1.21 2013/10/19 14:18:39 blambert Exp $ */
/*
* Copyright (c) 2008 Reyk Floeter <reyk@openbsd.org>
@@ -101,8 +101,9 @@ trap_imsg(struct imsgev *iev, pid_t pid)
switch (sm->snmp_type) {
case SNMP_OBJECT:
- if (sm->snmp_len != sizeof(ostr))
+ if (sm->snmp_len > sizeof(ostr) - 1)
goto imsgdone;
+ bzero(&ostr, sizeof(ostr));
bcopy(sm + 1, &ostr, sm->snmp_len);
a = ber_add_oidstring(a, ostr);
break;