mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-04 22:14:49 +00:00
bgpd: fix memory leak when parsing capabilities
Duplicated domain name capability messages cause memory leak. The amount of leaked memory is proportional to the size of the duplicated capabilities. This bug was introduced in 2015. To hit this, a BGP OPEN message must contain multiple FQDN capabilities. Memory is leaked when the hostname portion of the capability is of length 0, but the domainname portion is not, for any of the duplicated capabilities beyond the first one. https://tools.ietf.org/html/draft-walton-bgp-hostname-capability-00 Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
This commit is contained in:
parent
c49bafc254
commit
aba5353c17
@ -747,6 +747,12 @@ static int bgp_capability_hostname(struct peer *peer,
|
||||
|
||||
if (len) {
|
||||
str[len] = '\0';
|
||||
|
||||
if (peer->domainname != NULL) {
|
||||
XFREE(MTYPE_BGP_PEER_HOST, peer->domainname);
|
||||
peer->domainname = NULL;
|
||||
}
|
||||
|
||||
peer->domainname = XSTRDUP(MTYPE_BGP_PEER_HOST, str);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user