aboutsummaryrefslogtreecommitdiff
path: root/instrumentation/SanitizerCoverageLTO.so.cc
diff options
context:
space:
mode:
authorvanhauser-thc <vh@thc.org>2021-03-02 16:24:43 +0100
committervanhauser-thc <vh@thc.org>2021-03-02 16:24:43 +0100
commit333509bb0a56be9bd2e236f0e2f37d4af2dd7d59 (patch)
tree011f0afcfa23a1fc88b587a7a5be6c3981dd02dd /instrumentation/SanitizerCoverageLTO.so.cc
parentc269c3977ccb96710a2488b19c72bae51832a827 (diff)
downloadafl++-333509bb0a56be9bd2e236f0e2f37d4af2dd7d59.tar.gz
better unicode support
Diffstat (limited to 'instrumentation/SanitizerCoverageLTO.so.cc')
-rw-r--r--instrumentation/SanitizerCoverageLTO.so.cc14
1 files changed, 9 insertions, 5 deletions
diff --git a/instrumentation/SanitizerCoverageLTO.so.cc b/instrumentation/SanitizerCoverageLTO.so.cc
index 942d5357..849b6eef 100644
--- a/instrumentation/SanitizerCoverageLTO.so.cc
+++ b/instrumentation/SanitizerCoverageLTO.so.cc
@@ -872,17 +872,21 @@ bool ModuleSanitizerCoverage::instrumentModule(
// was not already added
if (!isMemcmp) {
- if (addedNull == false) {
+ if (addedNull == false && thestring[optLen - 1] != '\0') {
thestring.append("\0", 1); // add null byte
optLen++;
}
- // ensure we do not have garbage
- size_t offset = thestring.find('\0', 0);
- if (offset + 1 < optLen) optLen = offset + 1;
- thestring = thestring.substr(0, optLen);
+ if (!isStdString) {
+
+ // ensure we do not have garbage
+ size_t offset = thestring.find('\0', 0);
+ if (offset + 1 < optLen) optLen = offset + 1;
+ thestring = thestring.substr(0, optLen);
+
+ }
}