mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-07-27 13:46:45 +00:00
bgpd: Set the software version capability received flag only after a validation
We shouldn't set it blindly once the packet is received, but first we have to do some sanity checks. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
This commit is contained in:
parent
bfc2a205ab
commit
cc75bdf026
@ -889,8 +889,6 @@ static int bgp_capability_software_version(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_SOFT_VERSION_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(
|
||||||
@ -900,6 +898,8 @@ static int bgp_capability_software_version(struct peer *peer,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SET_FLAG(peer->cap, PEER_CAP_SOFT_VERSION_RCV);
|
||||||
|
|
||||||
if (len > BGP_MAX_SOFT_VERSION) {
|
if (len > BGP_MAX_SOFT_VERSION) {
|
||||||
flog_warn(EC_BGP_CAPABILITY_INVALID_LENGTH,
|
flog_warn(EC_BGP_CAPABILITY_INVALID_LENGTH,
|
||||||
"%s: Received Software Version, but the length is too big, truncating, from peer %s",
|
"%s: Received Software Version, but the length is too big, truncating, from peer %s",
|
||||||
|
Loading…
Reference in New Issue
Block a user