mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-05-29 18:56:41 +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;
|
size_t end = stream_get_getp(s) + hdr->length;
|
||||||
uint8_t len;
|
uint8_t len;
|
||||||
|
|
||||||
SET_FLAG(peer->cap, PEER_CAP_HOSTNAME_RCV);
|
|
||||||
|
|
||||||
len = stream_getc(s);
|
len = stream_getc(s);
|
||||||
if (stream_get_getp(s) + len > end) {
|
if (stream_get_getp(s) + len > end) {
|
||||||
flog_warn(
|
flog_warn(
|
||||||
@ -877,6 +875,8 @@ static int bgp_capability_hostname(struct peer *peer,
|
|||||||
peer->domainname = XSTRDUP(MTYPE_BGP_PEER_HOST, str);
|
peer->domainname = XSTRDUP(MTYPE_BGP_PEER_HOST, str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SET_FLAG(peer->cap, PEER_CAP_HOSTNAME_RCV);
|
||||||
|
|
||||||
if (bgp_debug_neighbor_events(peer)) {
|
if (bgp_debug_neighbor_events(peer)) {
|
||||||
zlog_debug("%s received hostname %s, domainname %s", peer->host,
|
zlog_debug("%s received hostname %s, domainname %s", peer->host,
|
||||||
peer->hostname, peer->domainname);
|
peer->hostname, peer->domainname);
|
||||||
|
Loading…
Reference in New Issue
Block a user