Skip to content

Commit

Permalink
bgpd: Adjust the length of tunnel encap sub-tlv by sub-tlv type
Browse files Browse the repository at this point in the history
Fixes: 79563af ("bgpd: Get 1 or 2 octets for Sub-TLV length (Tunnel Encap attr)")

Signed-off-by: Donatas Abraitis <[email protected]>
  • Loading branch information
ton31337 committed Jun 13, 2024
1 parent d8e3121 commit 34b209f
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions bgpd/bgp_attr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit 34b209f

Please sign in to comment.