]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect: do not upgrade base64 decode when fuzzing 6810/head
authorPhilippe Antoine <contact@catenacyber.fr>
Thu, 9 Dec 2021 19:43:56 +0000 (20:43 +0100)
committerVictor Julien <vjulien@oisf.net>
Tue, 18 Jan 2022 16:41:24 +0000 (17:41 +0100)
As fuzzing will put a very big value, and then
ThreadCtxDoInit will try to allocate it,
ending in out of memory

src/detect-base64-decode.c

index 751a6972a30c24d549a561e1f0ceb1caece78412..44c7c449890e1fe192f93fdbe359cbe1202dca34 100644 (file)
@@ -233,6 +233,9 @@ static int DetectBase64DecodeSetup(DetectEngineCtx *de_ctx, Signature *s,
         data->bytes = BASE64_DECODE_MAX;
     }
     if (data->bytes > de_ctx->base64_decode_max_len) {
+#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
+        data->bytes = BASE64_DECODE_MAX;
+#endif
         de_ctx->base64_decode_max_len = data->bytes;
     }