summaryrefslogtreecommitdiff
path: root/usr.sbin/snmpd
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2008-03-12 14:30:12 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2008-03-12 14:30:12 +0000
commit6661a9d5e2bd428565932e5dd9774d6e174b190c (patch)
treeb76b9ac34b269df892859120ae6815df1008105c /usr.sbin/snmpd
parent13e086eac91e0ab75a576acebe63b3f3e5dbfa97 (diff)
Check that the current ber element is a sequence or a set when '{' or '('
is used. OK reyk@
Diffstat (limited to 'usr.sbin/snmpd')
-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;