Hi,

any initialization of the form

        struct ber_oid trapoid = OID(MIB_snmpTrapOID);

requires a smi_scalar_oidlen() afterwards to set 'bo_n' to the correct
length.

The old ber_oid_cmp() from usr.sbin/snmpd/ber.c used to iterate over
all elements of 'bo_id' and not just the first 'bo_n' ones. So calling
smi_scalar_oidlen() wasn't a requirement here. However, with the new
ober_oid_cmp() it is, since this version only iterates up to 'bo_n'
array elements.

Gerhard



Index: usr.sbin/snmpd/trap.c
===================================================================
RCS file: /cvs/src/usr.sbin/snmpd/trap.c,v
retrieving revision 1.33
diff -u -p -u -p -r1.33 trap.c
--- usr.sbin/snmpd/trap.c       24 Oct 2019 12:39:27 -0000      1.33
+++ usr.sbin/snmpd/trap.c       9 Dec 2019 13:32:21 -0000
@@ -83,6 +83,8 @@ trap_agentx(struct agentx_handle *h, str
                goto done;
        }
 
+       smi_scalar_oidlen(&uptime);
+       smi_scalar_oidlen(&trapoid);
        while (pdu->datalen > sizeof(struct agentx_hdr)) {
                x++;
 

Reply via email to