Skip to content

Commit

Permalink
snmp: fix dangling pointer in snmp_traps
Browse files Browse the repository at this point in the history
  • Loading branch information
j123b567 committed Nov 1, 2024
1 parent 73fcf72 commit d274279
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/apps/snmp/snmp_traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
{
Expand Down Expand Up @@ -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]);
Expand Down

0 comments on commit d274279

Please sign in to comment.