]> git.puffer.fish Git - matthieu/frr.git/commitdiff
FUZZER: Certain types of fuzzing requires a default ospf instance
authorDonald Sharp <sharpd@nvidia.com>
Mon, 11 Sep 2023 16:23:03 +0000 (12:23 -0400)
committerDonald Sharp <sharpd@nvidia.com>
Mon, 11 Sep 2023 16:28:43 +0000 (12:28 -0400)
Crash found in the fuzzer is because the ospf pointer looked
up for the default vrf instance returns NULL, which immediately
crashes.  Normal OSPF code, to even get here, requires a default
instance of ospf.  As such the fuzzing code violated a tenant
of the main ospf code.  Let's just fix the ospf fuzzing code
to create a default vrf and then associate the ospf code
with it.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
ospfd/ospf_main.c

index 9d57007ca6111e6627fddddfe029106a10f274f1..df1e39b9246a89b2ddc52e8c16e65da3eb2873f7 100644 (file)
@@ -173,11 +173,12 @@ static struct ospf *FuzzingCreateOspf(void)
 {
        struct prefix p;
        struct interface *ifp = if_get_by_name("fuzziface", 0, "default");
+       struct vrf *vrf = vrf_get(VRF_DEFAULT, VRF_DEFAULT_NAME);
        ifp->mtu = 68;
        str2prefix("11.0.2.0/24", &p);
 
        bool created;
-       struct ospf *o = ospf_get(0, "omgwtfbbq", &created);
+       struct ospf *o = ospf_get(0, VRF_DEFAULT_NAME, &created);
        o->fd = 69;
 
        struct in_addr in;
@@ -354,4 +355,4 @@ done:
        /* Not reached. */
        return 0;
 }
-#endif
\ No newline at end of file
+#endif