summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartijn van Duren <martijn@cvs.openbsd.org>2024-02-20 12:32:49 +0000
committerMartijn van Duren <martijn@cvs.openbsd.org>2024-02-20 12:32:49 +0000
commitca3bcca4b7e089cbc50c114e2d8cf0af15f7c54e (patch)
tree806160c164f79787a5f8af7758826241e255d2b6
parent25a5adb5015d2db6f448c99ab476b236f951df9e (diff)
trap receiver is special in that the OID is optional. Make sure that we
accept a NULL descriptor, which results in an OID length of 0. Found by and OK sthen@
-rw-r--r--usr.sbin/snmpd/parse.y12
1 files changed, 8 insertions, 4 deletions
diff --git a/usr.sbin/snmpd/parse.y b/usr.sbin/snmpd/parse.y
index f3b0925aa95..541a65f21ef 100644
--- a/usr.sbin/snmpd/parse.y
+++ b/usr.sbin/snmpd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.89 2024/02/06 15:36:11 martijn Exp $ */
+/* $OpenBSD: parse.y,v 1.90 2024/02/20 12:32:48 martijn Exp $ */
/*
* Copyright (c) 2007, 2008, 2012 Reyk Floeter <reyk@openbsd.org>
@@ -1759,9 +1759,13 @@ resolve_oids(void)
free(trapcmds);
for (i = 0; i < ntrapaddresses; i++) {
- if (resolve_oid(
- &trapaddresses[i].tr->ta_oid, &trapaddresses[i].oid) == -1)
- return -1;
+ if (trapaddresses[i].oid.descriptor == NULL)
+ trapaddresses[i].tr->ta_oid.bo_n = 0;
+ else {
+ if (resolve_oid(&trapaddresses[i].tr->ta_oid,
+ &trapaddresses[i].oid) == -1)
+ return -1;
+ }
TAILQ_INSERT_TAIL(&conf->sc_trapreceivers,
trapaddresses[i].tr, entry);
}