]> git.puffer.fish Git - matthieu/frr.git/commit
bgpd: fix crash when polling bgp4v2PathAttrTable
authorFrancois Dumontet <francois.dumontet@6wind.com>
Mon, 21 Oct 2024 10:49:50 +0000 (12:49 +0200)
committerMergify <37929162+mergify[bot]@users.noreply.github.com>
Tue, 29 Oct 2024 12:13:37 +0000 (12:13 +0000)
commitc35b299b9f6e4948a892bfc76b0d1f5cddb87252
tree752d88961de5467a71a238c2eba11ef092b3da34
parent4723daf6089c916401d59c9bee1948baf90e0cef
bgpd:  fix crash when polling bgp4v2PathAttrTable

we have

(gdb) p *path->attr->aspath
$1 = {refcnt = 3, segments = 0x0, json = 0x0, str = 0x55723d0b7470 "", str_len = 0, asnotation = ASNOTATION_PLAIN}

It looks like this aspath is empty, resulting in a size 0 and NULL pointer for path->attr->aspath->segments which leads to the SIGSEGV

fixe: return 0 when segments is null.

Signed-off-by: Francois Dumontet <francois.dumontet@6wind.com>
(cherry picked from commit ee2f1b85cf95fcbfd0a54dc15b911f525e96b163)
bgpd/bgp_snmp_bgp4v2.c