about summary refs log tree commit diff
path: root/custom_mutators/autotokens/autotokens.cpp
diff options
context:
space:
mode:
authorvanhauser-thc <vh@thc.org>2023-02-04 15:39:03 +0100
committervanhauser-thc <vh@thc.org>2023-02-04 15:39:03 +0100
commit90f61552f794fc0fae5dc2585f81f31d32db1e89 (patch)
treed10497ce19d635ed371043e281b6f44d78dd7310 /custom_mutators/autotokens/autotokens.cpp
parentec87abda93d68f489f26ed2a2ae75b4f1e26d0bb (diff)
downloadafl++-90f61552f794fc0fae5dc2585f81f31d32db1e89.tar.gz
changes
Diffstat (limited to 'custom_mutators/autotokens/autotokens.cpp')
-rw-r--r--custom_mutators/autotokens/autotokens.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/custom_mutators/autotokens/autotokens.cpp b/custom_mutators/autotokens/autotokens.cpp
index a0125851..46a347f8 100644
--- a/custom_mutators/autotokens/autotokens.cpp
+++ b/custom_mutators/autotokens/autotokens.cpp
@@ -34,6 +34,9 @@ extern "C" {
 #ifndef AUTOTOKENS_SPLICE_DISABLE
   #define AUTOTOKENS_SPLICE_DISABLE 0
 #endif
+#ifndef AFL_TXT_MAX_LEN
+  #define AFL_TXT_MAX_LEN 65535
+#endif
 
 #if AUTOTOKENS_SPLICE_MIN >= AUTOTOKENS_SIZE_MIN
   #error SPLICE_MIN must be lower than SIZE_MIN
@@ -571,6 +574,15 @@ extern "C" unsigned char afl_custom_queue_get(void                *data,
       DEBUGF(stderr, "Too short (%lu) %s\n", len, filename);
       return 1;
 
+    } else
+    if (len > AFL_TXT_MAX_LEN) {
+
+      fclose(fp);
+      file_mapping[fn] = structure;  // NULL ptr so we don't read the file again
+      s = NULL;
+      DEBUGF(stderr, "Too long (%lu) %s\n", len, filename);
+      return 1;
+
     }
 
     string input;