]> git.proxmox.com Git - mirror_frr.git/commitdiff
bgpd: Fix crash when showing filtered routes
authorPascal Mathis <mail@pascalmathis.com>
Thu, 14 Jun 2018 17:40:36 +0000 (19:40 +0200)
committerPascal Mathis <mail@pascalmathis.com>
Thu, 14 Jun 2018 22:08:46 +0000 (00:08 +0200)
This commit fixes the issue mentioned in #2419, which is caused by a
double-free. The problem of the current implementation is that
*bgp_input_modifier* already frees the passed attributes under specific
circumstances, which can then lead to a double-free as *bgp_attr_undup*
does not check if the attributes are set to NULL.

As it is not transparent to the function caller if the attributes get
freed or not and the similar function *bgp_output_modifier* also does
not flush the passed attributes, the line has been removed altogether.

All callers of *bgp_input_modifier* already deal by themself with
freeing/flushing/unduping BGP attributes, so it is safe to remove.

Signed-off-by: Pascal Mathis <mail@pascalmathis.com>
bgpd/bgp_route.c

index 0a15eb504080a5d38c16640de428b1edad6a56e1..95e7def8fb0eadea55c0905d48ba78c532c1ccb8 100644 (file)
@@ -1185,12 +1185,8 @@ static int bgp_input_modifier(struct peer *peer, struct prefix *p,
 
                peer->rmap_type = 0;
 
-               if (ret == RMAP_DENYMATCH) {
-                       /* Free newly generated AS path and community by
-                        * route-map. */
-                       bgp_attr_flush(attr);
+               if (ret == RMAP_DENYMATCH)
                        return RMAP_DENY;
-               }
        }
        return RMAP_PERMIT;
 }