diff options
| author | Donatas Abraitis <donatas@opensourcerouting.org> | 2024-06-13 08:43:21 +0300 |
|---|---|---|
| committer | Donatas Abraitis <donatas@opensourcerouting.org> | 2024-06-13 08:43:21 +0300 |
| commit | 34b209f0ae2caca0d1ebcde9d4095375ac31b562 (patch) | |
| tree | 68f714b8431bd5a2eddbd7d46ed5878c16ad0348 /bgpd/bgp_attr.c | |
| parent | d8e3121cb8470fe9a934100de9170b4ef48b17a6 (diff) | |
bgpd: Adjust the length of tunnel encap sub-tlv by sub-tlv type
Fixes: 79563af564ad0fe5b9c8d95bf080d570f87b1859 ("bgpd: Get 1 or 2 octets for Sub-TLV length (Tunnel Encap attr)")
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
Diffstat (limited to 'bgpd/bgp_attr.c')
| -rw-r--r-- | bgpd/bgp_attr.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c index da4701d069..9f377589e9 100644 --- a/bgpd/bgp_attr.c +++ b/bgpd/bgp_attr.c @@ -2728,10 +2728,13 @@ static int bgp_attr_encap(struct bgp_attr_parser_args *args) if (BGP_ATTR_ENCAP == type) { subtype = stream_getc(BGP_INPUT(peer)); - sublength = (subtype < 128) - ? stream_getc(BGP_INPUT(peer)) - : stream_getw(BGP_INPUT(peer)); - length -= 2; + if (subtype < 128) { + sublength = stream_getc(BGP_INPUT(peer)); + length -= 2; + } else { + sublength = stream_getw(BGP_INPUT(peer)); + length -= 3; + } #ifdef ENABLE_BGP_VNC } else { subtype = stream_getw(BGP_INPUT(peer)); |
