Skip to content

Commit

Permalink
bgpd: Fix use after free of ecommunities
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Sohn <[email protected]>
  • Loading branch information
Sohn123 committed Sep 25, 2023
1 parent 2f7cdc4 commit 11677dd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion bgpd/bgp_route.c
Original file line number Diff line number Diff line change
Expand Up @@ -11858,6 +11858,8 @@ int bgp_show_table_rtc(struct vty *vty, struct bgp *bgp, safi_t safi,
"Prefix: \n\tRoute Target: %s/%u\n\tOrigin-as: %u\n",
ecomstr, local_p.prefixlen,
local_p.u.prefix_rtc.origin_as);
XFREE(MTYPE_ECOMMUNITY_STR, ecomstr);
ecommunity_unintern(&ecom);
route_vty_out_detail_header(vty, bgp, dest, &local_p,
NULL, AFI_IP, safi, NULL,
false);
Expand Down Expand Up @@ -16049,7 +16051,7 @@ void bgp_config_write_network(struct vty *vty, struct bgp *bgp, afi_t afi,
ecom, ECOMMUNITY_FORMAT_ROUTE_MAP,
ECOMMUNITY_ROUTE_TARGET);
vty_out(vty, " rt %s", b);
ecommunity_free(&ecom);
ecommunity_unintern(&ecom);
XFREE(MTYPE_ECOMMUNITY_STR, b);
} else {
vty_out(vty, " rt 0:0");
Expand Down

0 comments on commit 11677dd

Please sign in to comment.