Merge pull request #6903 from ton31337/fix/prevent_null_pointer_dereference_for_aspath

bgpd: Reuse bgp_adj_in for attr to avoid null dereference under aspath
This commit is contained in:
Rafael Zalamena 2020-08-26 10:07:53 -03:00 committed by GitHub
commit 0856cc337f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3063,12 +3063,14 @@ static uint32_t bgp_filtered_routes_count(struct peer *peer, afi_t afi,
bool filtered = false;
struct bgp_dest *dest;
struct bgp_adj_in *ain;
struct attr attr = {};
struct bgp_table *table = peer->bgp->rib[afi][safi];
for (dest = bgp_table_top(table); dest; dest = bgp_route_next(dest)) {
for (ain = dest->adj_in; ain; ain = ain->next) {
const struct prefix *rn_p = bgp_dest_get_prefix(dest);
struct attr attr = {};
attr = *ain->attr;
if (bgp_input_filter(peer, rn_p, &attr, afi, safi)
== FILTER_DENY)