Revert "bgpd: fix insecure data write with ip addresses"

This reverts commit 54222f9213.

(cherry picked from commit 298d534013)
This commit is contained in:
Donald Sharp 2023-10-10 13:31:13 -04:00 committed by Mergify
parent 83d4391f7b
commit 8ed3bbd19d

View File

@ -577,8 +577,7 @@ static bool bgp_linkstate_nlri_value_display(char *buf, size_t size,
break;
case BGP_LS_TLV_IP_REACHABILITY_INFORMATION:
mask_length = pnt_decode8(&pnt);
if (nlri_type == BGP_LINKSTATE_PREFIX4 &&
((length - sizeof(mask_length)) <= sizeof(ipv4.s_addr))) {
if (nlri_type == BGP_LINKSTATE_PREFIX4) {
memcpy(&ipv4.s_addr, pnt, length - sizeof(mask_length));
if (json)
json_object_string_addf(json, "ipReachability",
@ -588,8 +587,7 @@ static bool bgp_linkstate_nlri_value_display(char *buf, size_t size,
snprintfrr(buf, size, "%sIPv4:%pI4/%u",
first ? "" : " ", &ipv4,
mask_length);
} else if (nlri_type == BGP_LINKSTATE_PREFIX6 &&
((length - sizeof(mask_length)) <= sizeof(ipv6))) {
} else if (nlri_type == BGP_LINKSTATE_PREFIX6) {
memcpy(&ipv6, pnt, length - sizeof(mask_length));
if (json)
json_object_string_addf(json, "ipReachability",