diff options
author | van Hauser <vh@thc.org> | 2022-02-22 13:58:49 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-22 13:58:49 +0100 |
commit | fee1acf7e6096533f1aa8cd74035bed21c90fdf6 (patch) | |
tree | f870692214c80ebefc452e62424ebcf0a50c8b79 /instrumentation/afl-llvm-dict2file.so.cc | |
parent | 675d17d737ee5dee88766d9c181567771592c94c (diff) | |
parent | 914eb79cbc14b26b51172a7b14c2a5a3a0ed2875 (diff) | |
download | afl++-fee1acf7e6096533f1aa8cd74035bed21c90fdf6.tar.gz |
Merge branch 'newpm2' into dev
Diffstat (limited to 'instrumentation/afl-llvm-dict2file.so.cc')
-rw-r--r-- | instrumentation/afl-llvm-dict2file.so.cc | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/instrumentation/afl-llvm-dict2file.so.cc b/instrumentation/afl-llvm-dict2file.so.cc index 94dc6984..a554c40e 100644 --- a/instrumentation/afl-llvm-dict2file.so.cc +++ b/instrumentation/afl-llvm-dict2file.so.cc @@ -589,7 +589,6 @@ bool AFLdict2filePass::runOnModule(Module &M) { if (optLen < 2) { continue; } if (literalLength + 1 == optLen) { // add null byte - thestring.append("\0", 1); } @@ -612,11 +611,17 @@ bool AFLdict2filePass::runOnModule(Module &M) { } */ - if (!isStdString && thestring.find('\0', 0) != std::string::npos) { + + if (!isStdString) { // ensure we do not have garbage size_t offset = thestring.find('\0', 0); - if (offset + 1 < optLen) optLen = offset + 1; + if (offset && offset < optLen && offset + 1 < optLen) { + + optLen = offset + 1; + + } + thestring = thestring.substr(0, optLen); } |