From ba93604f4546861004c93cea8e6006b36607ab74 Mon Sep 17 00:00:00 2001 From: martijn Date: Tue, 20 Feb 2024 12:32:48 +0000 Subject: [PATCH] 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@ --- usr.sbin/snmpd/parse.y | 12 ++++++++---- 1 file 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 @@ -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); } -- 2.20.1