]> git.puffer.fish Git - matthieu/frr.git/commitdiff
fpm: guard against garbage in unused address bytes
authorDavid Lamparter <equinox@opensourcerouting.org>
Wed, 22 Jan 2025 10:15:17 +0000 (11:15 +0100)
committerMergify <37929162+mergify[bot]@users.noreply.github.com>
Tue, 11 Feb 2025 08:43:50 +0000 (08:43 +0000)
Zero out the 12 unused bytes (for the IPv6 address) when reading in an
IPv4 address.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
(cherry picked from commit 95cf0b227980999e2af22a2c171e5237e5ffca8e)

fpm/fpm_pb.h

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