about summary refs log tree commit diff
diff options
context:
space:
mode:
authorvanhauser-thc <vh@thc.org>2023-01-19 22:24:24 +0100
committervanhauser-thc <vh@thc.org>2023-01-19 22:24:24 +0100
commit67cfe4f6d4a03c596a5c3e1aa97d64d79263746a (patch)
tree15ac1e3490ea601fe607ba441969d57580542be7
parent628b4b60021a0d62a2eccddca4fe321c9d57c663 (diff)
downloadafl++-67cfe4f6d4a03c596a5c3e1aa97d64d79263746a.tar.gz
nits
-rw-r--r--custom_mutators/autotokens/autotokens.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/custom_mutators/autotokens/autotokens.cpp b/custom_mutators/autotokens/autotokens.cpp
index f4b96c7b..16ee8109 100644
--- a/custom_mutators/autotokens/autotokens.cpp
+++ b/custom_mutators/autotokens/autotokens.cpp
@@ -544,7 +544,15 @@ extern "C" unsigned char afl_custom_queue_get(void                *data,
     string input;
     input.resize(len);
     rewind(fp);
-    fread((void *)input.data(), input.size(), 1, fp);
+
+    if (fread((void *)input.data(), 1, len, fp) != len) {
+
+      s = NULL;
+      DEBUGF(stderr, "Too short read %s\n", len, filename);
+      return 0;
+
+    }
+
     fclose(fp);
 
     if (!afl_ptr->shm.cmplog_mode) {