diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c index 3b5261fdf944..aa271da07f10 100644 --- a/bgpd/bgp_attr.c +++ b/bgpd/bgp_attr.c @@ -2227,11 +2227,12 @@ bgp_attr_pmsi_tunnel(struct bgp_attr_parser_args *args) struct attr *const attr = args->attr; const bgp_size_t length = args->length; uint8_t tnl_type; + int attr_parse_len = 2 + BGP_LABEL_BYTES; /* Verify that the receiver is expecting "ingress replication" as we * can only support that. */ - if (length < 2) { + if (length < attr_parse_len) { flog_err(EC_BGP_ATTR_LEN, "Bad PMSI tunnel attribute length %d", length); return bgp_attr_malformed(args, BGP_NOTIFY_UPDATE_ATTR_LENG_ERR, @@ -2258,9 +2259,10 @@ bgp_attr_pmsi_tunnel(struct bgp_attr_parser_args *args) attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_PMSI_TUNNEL); attr->pmsi_tnl_type = tnl_type; + stream_get(&attr->label, peer->curr, BGP_LABEL_BYTES); /* Forward read pointer of input stream. */ - stream_forward_getp(peer->curr, length - 2); + stream_forward_getp(peer->curr, length - attr_parse_len); return BGP_ATTR_PARSE_PROCEED; }