From b9be6164064916d84781b0cc6552faeca359e545 Mon Sep 17 00:00:00 2001 From: Philippe Antoine Date: Mon, 20 Sep 2021 20:45:10 +0200 Subject: [PATCH] fuzz: fixes a leak in applayerparse target 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. (cherry picked from commit ca054f726464fcc55242b7c851d75557c96b3d83) --- src/tests/fuzz/fuzz_applayerparserparse.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/tests/fuzz/fuzz_applayerparserparse.c b/src/tests/fuzz/fuzz_applayerparserparse.c index 06a8ad4e8b..6d5a560cd7 100644 --- a/src/tests/fuzz/fuzz_applayerparserparse.c +++ b/src/tests/fuzz/fuzz_applayerparserparse.c @@ -133,6 +133,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 && -- 2.47.2