summaryrefslogtreecommitdiffstats
path: root/usr.sbin/snmpd
diff options
context:
space:
mode:
authormartijn <martijn@openbsd.org>2018-11-20 07:20:21 +0000
committermartijn <martijn@openbsd.org>2018-11-20 07:20:21 +0000
commit6b0574aedca612fbd89b416bdf7ec02c63c9a0af (patch)
treec619f92fc142ecb2e01f67bae1ad4b194998df30 /usr.sbin/snmpd
parentFix the case where the recursion detection isn't reset when the command is (diff)
downloadwireguard-openbsd-6b0574aedca612fbd89b416bdf7ec02c63c9a0af.tar.xz
wireguard-openbsd-6b0574aedca612fbd89b416bdf7ec02c63c9a0af.zip
Fix when ber_free_elements is called with a NULL-value.
Found via snmpctl snmp walk 127.0.0.1 oid 1 OK claudio@
Diffstat (limited to 'usr.sbin/snmpd')
-rw-r--r--usr.sbin/snmpd/ber.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.sbin/snmpd/ber.c b/usr.sbin/snmpd/ber.c
index 407a6791aec..23166419be4 100644
--- a/usr.sbin/snmpd/ber.c
+++ b/usr.sbin/snmpd/ber.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ber.c,v 1.48 2018/08/12 22:04:09 rob Exp $ */
+/* $OpenBSD: ber.c,v 1.49 2018/11/20 07:20:21 martijn Exp $ */
/*
* Copyright (c) 2007, 2012 Reyk Floeter <reyk@openbsd.org>
@@ -894,6 +894,8 @@ ber_free_element(struct ber_element *root)
void
ber_free_elements(struct ber_element *root)
{
+ if (root == NULL)
+ return;
if (root->be_sub && (root->be_encoding == BER_TYPE_SEQUENCE ||
root->be_encoding == BER_TYPE_SET))
ber_free_elements(root->be_sub);