fpm: guard against garbage in unused address bytes

Zero out the 12 unused bytes (for the IPv6 address) when reading in an
IPv4 address.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
This commit is contained in:
David Lamparter 2025-01-22 11:15:17 +01:00
parent ce7f5b2122
commit 95cf0b2279

View file

@ -111,6 +111,7 @@ static inline int fpm__nexthop__get(const Fpm__Nexthop *nh,
nexthop->vrf_id = VRF_DEFAULT; nexthop->vrf_id = VRF_DEFAULT;
nexthop->type = NEXTHOP_TYPE_IPV4; nexthop->type = NEXTHOP_TYPE_IPV4;
memset(&nexthop->gate, 0, sizeof(nexthop->gate));
nexthop->gate.ipv4 = ipv4; nexthop->gate.ipv4 = ipv4;
if (ifindex) { if (ifindex) {
nexthop->type = NEXTHOP_TYPE_IPV4_IFINDEX; nexthop->type = NEXTHOP_TYPE_IPV4_IFINDEX;