mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-05-24 19:37:51 +00:00
bgpd: Make sure we have enough data to read restart time and flags for GR cap
Just a safety check to avoid out of bound reading. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
This commit is contained in:
parent
23fa9b4107
commit
7d5873cdc4
@ -2817,8 +2817,15 @@ static void bgp_dynamic_capability_graceful_restart(uint8_t *pnt, int action,
|
|||||||
uint16_t gr_restart_flag_time;
|
uint16_t gr_restart_flag_time;
|
||||||
uint8_t *data = pnt + 3;
|
uint8_t *data = pnt + 3;
|
||||||
uint8_t *end = pnt + hdr->length;
|
uint8_t *end = pnt + hdr->length;
|
||||||
|
size_t len = end - data;
|
||||||
|
|
||||||
if (action == CAPABILITY_ACTION_SET) {
|
if (action == CAPABILITY_ACTION_SET) {
|
||||||
|
if (len < sizeof(gr_restart_flag_time)) {
|
||||||
|
zlog_err("%pBP: Received invalid Graceful-Restart capability length %d",
|
||||||
|
peer, hdr->length);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
SET_FLAG(peer->cap, PEER_CAP_RESTART_RCV);
|
SET_FLAG(peer->cap, PEER_CAP_RESTART_RCV);
|
||||||
ptr_get_be16(data, &gr_restart_flag_time);
|
ptr_get_be16(data, &gr_restart_flag_time);
|
||||||
data += sizeof(gr_restart_flag_time);
|
data += sizeof(gr_restart_flag_time);
|
||||||
|
Loading…
Reference in New Issue
Block a user