]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
fuzz: fixes a leak in applayerparse target
authorPhilippe Antoine <contact@catenacyber.fr>
Mon, 20 Sep 2021 18:45:10 +0000 (20:45 +0200)
committerVictor Julien <victor@inliniac.net>
Tue, 21 Sep 2021 05:13:35 +0000 (07:13 +0200)
If a protocol change was requested, the target did not handle
it as Suricata, as the target is meant to handle only one
app-layer protocol.

src/tests/fuzz/fuzz_applayerparserparse.c

index 3a10763abb008307924b8bcd6553011f50a4d220..bc8efea806d212f97c9a5e78bf9b968047dc51cf 100644 (file)
@@ -148,6 +148,11 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
             memcpy(isolatedBuffer, albuffer, alnext - albuffer);
             (void) AppLayerParserParse(NULL, alp_tctx, f, f->alproto, flags, isolatedBuffer, alnext - albuffer);
             free(isolatedBuffer);
+            if (FlowChangeProto(f)) {
+                // exits if a protocol change is requested
+                alsize = 0;
+                break;
+            }
             flags &= ~(STREAM_START);
             if (f->alparser &&
                    (((flags & STREAM_TOSERVER) != 0 &&