about summary refs log tree commit diff
path: root/instrumentation/afl-llvm-dict2file.so.cc
diff options
context:
space:
mode:
authorvanhauser-thc <vh@thc.org>2022-03-01 19:21:31 +0100
committervanhauser-thc <vh@thc.org>2022-03-01 19:21:31 +0100
commitf70760896c7a5d5f2b286d9ea71c8b6d90e98625 (patch)
tree12bc665023dfdf9a1c6ee6385d248f18c2ae16ba /instrumentation/afl-llvm-dict2file.so.cc
parentc9504867daa313603fdcd6dc409f156c41c76e99 (diff)
downloadafl++-f70760896c7a5d5f2b286d9ea71c8b6d90e98625.tar.gz
Revert "Merge branch 'newpm2' into dev"
This reverts commit fee1acf7e6096533f1aa8cd74035bed21c90fdf6, reversing
changes made to 675d17d737ee5dee88766d9c181567771592c94c.
Diffstat (limited to 'instrumentation/afl-llvm-dict2file.so.cc')
-rw-r--r--instrumentation/afl-llvm-dict2file.so.cc11
1 files changed, 3 insertions, 8 deletions
diff --git a/instrumentation/afl-llvm-dict2file.so.cc b/instrumentation/afl-llvm-dict2file.so.cc
index a554c40e..94dc6984 100644
--- a/instrumentation/afl-llvm-dict2file.so.cc
+++ b/instrumentation/afl-llvm-dict2file.so.cc
@@ -589,6 +589,7 @@ bool AFLdict2filePass::runOnModule(Module &M) {
 
               if (optLen < 2) { continue; }
               if (literalLength + 1 == optLen) {  // add null byte
+
                 thestring.append("\0", 1);
 
               }
@@ -611,17 +612,11 @@ bool AFLdict2filePass::runOnModule(Module &M) {
                         }
 
             */
-
-            if (!isStdString) {
+            if (!isStdString && thestring.find('\0', 0) != std::string::npos) {
 
               // ensure we do not have garbage
               size_t offset = thestring.find('\0', 0);
-              if (offset && offset < optLen && offset + 1 < optLen) {
-
-                optLen = offset + 1;
-
-              }
-
+              if (offset + 1 < optLen) optLen = offset + 1;
               thestring = thestring.substr(0, optLen);
 
             }