Merge pull request #11203 from donaldsharp/coverity_bgp_memcpy

bgpd: Fix coverity SA issue with copying over prefix data
This commit is contained in:
Donatas Abraitis 2022-05-17 18:42:51 +02:00 committed by GitHub
commit 14d5ebf652
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5694,12 +5694,12 @@ int bgp_nlri_parse_ip(struct peer *peer, struct attr *attr,
}
/* Defensive coding, double-check the psize fits in a struct
* prefix */
if (psize > (ssize_t)sizeof(p.u)) {
* prefix for the v4 and v6 afi's and unicast/multicast */
if (psize > (ssize_t)sizeof(p.u.val)) {
flog_err(
EC_BGP_UPDATE_RCV,
"%s [Error] Update packet error (prefix length %d too large for prefix storage %zu)",
peer->host, p.prefixlen, sizeof(p.u));
peer->host, p.prefixlen, sizeof(p.u.val));
return BGP_NLRI_PARSE_ERROR_PACKET_LENGTH;
}