summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorclaudio <claudio@openbsd.org>2008-03-12 14:30:11 +0000
committerclaudio <claudio@openbsd.org>2008-03-12 14:30:11 +0000
commit46f4a1b430456d038c4c4ec37a12f8e62b467ecc (patch)
tree43efdb3737d990450199169b70e2191d9188146c
parentmostly stylistic - always print the client host name in snmpe error (diff)
downloadwireguard-openbsd-46f4a1b430456d038c4c4ec37a12f8e62b467ecc.tar.xz
wireguard-openbsd-46f4a1b430456d038c4c4ec37a12f8e62b467ecc.zip
Check that the current ber element is a sequence or a set when '{' or '('
is used. OK reyk@
-rw-r--r--usr.sbin/snmpd/ber.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/usr.sbin/snmpd/ber.c b/usr.sbin/snmpd/ber.c
index 5610154024d..7a573cfa9b5 100644
--- a/usr.sbin/snmpd/ber.c
+++ b/usr.sbin/snmpd/ber.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ber.c,v 1.8 2008/03/12 13:09:12 claudio Exp $ */
+/* $OpenBSD: ber.c,v 1.9 2008/03/12 14:30:11 claudio Exp $ */
/*
* Copyright (c) 2007 Reyk Floeter <reyk@vantronix.net>
@@ -642,6 +642,9 @@ ber_scanf_elements(struct ber_element *ber, char *fmt, ...)
break;
case '{':
case '(':
+ if (ber->be_encoding != BER_TYPE_SEQUENCE &&
+ ber->be_encoding != BER_TYPE_SET)
+ goto fail;
if (ber->be_sub == NULL || level >= _MAX_SEQ)
goto fail;
parent[++level] = ber;