From: Philippe Antoine Date: Mon, 20 Sep 2021 18:45:10 +0000 (+0200) Subject: fuzz: fixes a leak in applayerparse target X-Git-Tag: suricata-7.0.0-beta1~1374 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ca054f726464fcc55242b7c851d75557c96b3d83;p=thirdparty%2Fsuricata.git 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. --- diff --git a/src/tests/fuzz/fuzz_applayerparserparse.c b/src/tests/fuzz/fuzz_applayerparserparse.c index 3a10763abb..bc8efea806 100644 --- a/src/tests/fuzz/fuzz_applayerparserparse.c +++ b/src/tests/fuzz/fuzz_applayerparserparse.c @@ -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 &&