Merge pull request #10883 from donaldsharp/bgp_evpn_stream_read

bgpd: Fix possible insufficient stream data
This commit is contained in:
Donatas Abraitis 2022-03-28 09:04:55 +03:00 committed by GitHub
commit 4ffc9d0f26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2572,6 +2572,16 @@ bgp_attr_srv6_service_data(struct bgp_attr_parser_args *args)
args->total);
}
if (length < BGP_PREFIX_SID_SRV6_L3_SERVICE_SID_STRUCTURE_LENGTH) {
flog_err(
EC_BGP_ATTR_LEN,
"Malformed SRv6 Service Data Sub-Sub-TLV attribute - insufficient data (need %hu, have %u remaining in UPDATE)",
BGP_PREFIX_SID_SRV6_L3_SERVICE_SID_STRUCTURE_LENGTH,
length);
return bgp_attr_malformed(args, BGP_NOTIFY_UPDATE_ATTR_LENG_ERR,
args->total);
}
if (type == BGP_PREFIX_SID_SRV6_L3_SERVICE_SID_STRUCTURE) {
loc_block_len = stream_getc(peer->curr);
loc_node_len = stream_getc(peer->curr);