From d2742794ce597bf5e551ba26f1479d869b1fe873 Mon Sep 17 00:00:00 2001 From: Jan Breuer Date: Fri, 1 Nov 2024 10:38:16 +0100 Subject: [PATCH] snmp: fix dangling pointer in snmp_traps --- src/apps/snmp/snmp_traps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/apps/snmp/snmp_traps.c b/src/apps/snmp/snmp_traps.c index 4acbe604..42511643 100644 --- a/src/apps/snmp/snmp_traps.c +++ b/src/apps/snmp/snmp_traps.c @@ -353,6 +353,7 @@ snmp_send_trap_or_notification_or_inform_generic(struct snmp_msg_trap *trap_msg, u32_t timestamp = 0; struct snmp_varbind *original_varbinds = varbinds; struct snmp_varbind *original_prev = NULL; + struct snmp_obj_id snmp_trap_oid = { 0 }; /* used for converting SNMPv1 generic/specific trap parameter to SNMPv2 snmpTrapOID */ struct snmp_varbind snmp_v2_special_varbinds[] = { /* First varbind is used to store sysUpTime */ { @@ -391,7 +392,6 @@ snmp_send_trap_or_notification_or_inform_generic(struct snmp_msg_trap *trap_msg, /* see rfc3584 */ if (trap_msg->snmp_version == SNMP_VERSION_2c) { - struct snmp_obj_id snmp_trap_oid = { 0 }; /* used for converting SNMPv1 generic/specific trap parameter to SNMPv2 snmpTrapOID */ err = snmp_prepare_trap_oid(&snmp_trap_oid, eoid, generic_trap, specific_trap); if (err == ERR_OK) { snmp_v2_special_varbinds[1].value_len = snmp_trap_oid.len * sizeof(snmp_trap_oid.id[0]);