mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-15 11:30:30 +00:00
Merge pull request #5337 from opensourcerouting/ldpd-buffer-overflow-7.1
[7.1] ldpd: add missing sanity check in the parsing of label messages
This commit is contained in:
commit
9e37611dd0
@ -723,6 +723,14 @@ tlv_decode_fec_elm(struct nbr *nbr, struct ldp_msg *msg, char *buf,
|
|||||||
/* Prefix Length */
|
/* Prefix Length */
|
||||||
map->fec.prefix.prefixlen = buf[off];
|
map->fec.prefix.prefixlen = buf[off];
|
||||||
off += sizeof(uint8_t);
|
off += sizeof(uint8_t);
|
||||||
|
if ((map->fec.prefix.af == AF_IPV4
|
||||||
|
&& map->fec.prefix.prefixlen > IPV4_MAX_PREFIXLEN)
|
||||||
|
|| (map->fec.prefix.af == AF_IPV6
|
||||||
|
&& map->fec.prefix.prefixlen > IPV6_MAX_PREFIXLEN)) {
|
||||||
|
session_shutdown(nbr, S_BAD_TLV_VAL, msg->id,
|
||||||
|
msg->type);
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
if (len < off + PREFIX_SIZE(map->fec.prefix.prefixlen)) {
|
if (len < off + PREFIX_SIZE(map->fec.prefix.prefixlen)) {
|
||||||
session_shutdown(nbr, S_BAD_TLV_LEN, msg->id,
|
session_shutdown(nbr, S_BAD_TLV_LEN, msg->id,
|
||||||
msg->type);
|
msg->type);
|
||||||
|
Loading…
Reference in New Issue
Block a user