mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-05-28 12:10:24 +00:00
bgpd: Set hostname capability received flag only if parsed correctly
If we receive a malformed packet, we might end-up with a bad state. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
This commit is contained in:
parent
9b178d246e
commit
0c74220c6e
@ -818,8 +818,6 @@ static int bgp_capability_hostname(struct peer *peer,
|
||||
size_t end = stream_get_getp(s) + hdr->length;
|
||||
uint8_t len;
|
||||
|
||||
SET_FLAG(peer->cap, PEER_CAP_HOSTNAME_RCV);
|
||||
|
||||
len = stream_getc(s);
|
||||
if (stream_get_getp(s) + len > end) {
|
||||
flog_warn(
|
||||
@ -877,6 +875,8 @@ static int bgp_capability_hostname(struct peer *peer,
|
||||
peer->domainname = XSTRDUP(MTYPE_BGP_PEER_HOST, str);
|
||||
}
|
||||
|
||||
SET_FLAG(peer->cap, PEER_CAP_HOSTNAME_RCV);
|
||||
|
||||
if (bgp_debug_neighbor_events(peer)) {
|
||||
zlog_debug("%s received hostname %s, domainname %s", peer->host,
|
||||
peer->hostname, peer->domainname);
|
||||
|
Loading…
Reference in New Issue
Block a user