The total number of octets of the Sub-TLV Value field. The Sub-TLV Length field
contains 1 octet if the Sub-TLV Type field contains a value in the range from
0-127. The Sub-TLV Length field contains two octets if the Sub-TLV Type field
contains a value in the range from 128-255.
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit
79563af564ad0fe5b9c8d95bf080d570f87b1859)
if (BGP_ATTR_ENCAP == type) {
subtype = stream_getc(BGP_INPUT(peer));
- sublength = stream_getc(BGP_INPUT(peer));
+ sublength = (subtype < 128)
+ ? stream_getc(BGP_INPUT(peer))
+ : stream_getw(BGP_INPUT(peer));
length -= 2;
#ifdef ENABLE_BGP_VNC
} else {