Skip to content

Commit

Permalink
bgpd: fix crash in *bgpv2PeerErrorsTable
Browse files Browse the repository at this point in the history
following crash occurs:
    at ./nptl/pthread_kill.c:44
    at ./nptl/pthread_kill.c:78
    at ./nptl/pthread_kill.c:89
    context=0x7ffd06d3d300)
    at /build/make-pkg/output/_packages/cp-routing/src/lib/sigevent.c:246
    length=0x7ffd06d3da88, exact=1, var_len=0x7ffd06d3da90, write_method=<optimized out>)
    at /build/make-pkg/output/_packages/cp-routing/src/bgpd/bgp_snmp_bgp4v2.c:364
    vp=vp@entry=0x7f7c88b584c0 <bgpv2_variables>, vp_len=vp_len@entry=102,
    ename=ename@entry=0x7f7c88b58440 <bgpv2_trap_oid>, enamelen=enamelen@entry=8,
    name=name@entry=0x7f7c88b58480 <bgpv2_oid>, namelen=namelen@entry=7,
    iname=0x7ffd06d3e7b0, index_len=1, trapobj=0x7f7c88b53b80 <bgpv2TrapBackListv6>,
    trapobjlen=6, sptrap=2 '\002')
    at /build/make-pkg/output/_packages/cp-routing/src/lib/agentx.c:382
    vp_len=vp_len@entry=102, ename=ename@entry=0x7f7c88b58440 <bgpv2_trap_oid>,
    enamelen=enamelen@entry=8, name=name@entry=0x7f7c88b58480 <bgpv2_oid>,
    namelen=namelen@entry=7, iname=0x7ffd06d3ec30, inamelen=16,
    trapobj=0x7f7c88b53b80 <bgpv2TrapBackListv6>, trapobjlen=6, sptrap=2 '\002')
    at /build/make-pkg/output/_packages/cp-routing/src/lib/agentx.c:298
    at /build/make-pkg/output/_packages/cp-routing/src/bgpd/bgp_snmp_bgp4v2.c:1496
    at /build/make-pkg/output/_packages/cp-routing/src/bgpd/bgp_fsm.c:48
    at /build/make-pkg/output/_packages/cp-routing/src/bgpd/bgp_fsm.c:1314
    event=Receive_NOTIFICATION_message)
    at /build/make-pkg/output/_packages/cp-routing/src/bgpd/bgp_fsm.c:2665
    at /build/make-pkg/output/_packages/cp-routing/src/bgpd/bgp_packet.c:3129
    at /build/make-pkg/output/_packages/cp-routing/src/lib/event.c:1979
    at /build/make-pkg/output/_packages/cp-routing/src/lib/libfrr.c:1213
    at /build/make-pkg/output/_packages/cp-routing/src/bgpd/bgp_main.c:510

it's due to function bgpv2PeerErrorsTable returning
return SNMP_STRING(msg_str);
with msg_str NULL rather the string ""

this commit avoid the issue.

Signed-off-by: Francois Dumontet <[email protected]>
  • Loading branch information
fdumontet6WIND committed Sep 1, 2023
1 parent c4e030a commit 14fc32e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions bgpd/bgp_snmp_bgp4v2.c
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,8 @@ static uint8_t *bgpv2PeerErrorsTable(struct variable *v, oid name[],
msg_str = bgp_notify_admin_message(
msg_buf, sizeof(msg_buf),
(uint8_t *)notify.data, notify.length);
if(!msg_str)
return SNMP_STRING("");
return SNMP_STRING(msg_str);
}
}
Expand Down

0 comments on commit 14fc32e

Please sign in to comment.