]> git.puffer.fish Git - matthieu/frr.git/commitdiff
fix memleak in libfuzzer entrypoint
authorQuentin Young <qlyoung@cumulusnetworks.com>
Sat, 11 Jan 2020 20:16:21 +0000 (15:16 -0500)
committerQuentin Young <qlyoung@nvidia.com>
Mon, 15 Nov 2021 19:52:42 +0000 (14:52 -0500)
bgpd/bgp_main.c

index 0284086dddaa795f34cbb20178014496eb5ad3d6..be946cde045625c253b398818dd6d9b30386b684 100644 (file)
@@ -494,8 +494,9 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
         * BGP message is correct, and this check is performed by the i/o code,
         * so we need to make sure that remains true for fuzzed input.
         * */
-       if (!validate_header(p))
-               return 0;
+       if (!validate_header(p)) {
+               goto done;
+       }
 
        int result = 0;
        unsigned char pktbuf[BGP_MAX_PACKET_SIZE];
@@ -517,6 +518,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
                result = bgp_process_packet(&t);
        }
 
+done:
        peer_delete(p);
        FuzzingPeer = NULL;