summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bgpd/bgp_attr.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c
index 7aabc2d820..159aa68fee 100644
--- a/bgpd/bgp_attr.c
+++ b/bgpd/bgp_attr.c
@@ -2707,10 +2707,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));