about summary refs log tree commit diff
path: root/llvm_mode/afl-llvm-lto-whitelist.so.cc
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2020-05-29 16:27:01 +0200
committervan Hauser <vh@thc.org>2020-05-29 16:27:01 +0200
commit2ce243bc6eee4b9d5830bf04369881cb8ee7f93b (patch)
treec2a578eb029f2c9076c2a6a2534b5d50d00b21e5 /llvm_mode/afl-llvm-lto-whitelist.so.cc
parent255594ba3a520ecb555e5c6ef4493f2508c63706 (diff)
downloadafl++-2ce243bc6eee4b9d5830bf04369881cb8ee7f93b.tar.gz
whitelist wildcard for LTO
Diffstat (limited to 'llvm_mode/afl-llvm-lto-whitelist.so.cc')
-rw-r--r--llvm_mode/afl-llvm-lto-whitelist.so.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm_mode/afl-llvm-lto-whitelist.so.cc b/llvm_mode/afl-llvm-lto-whitelist.so.cc
index 8856ce21..33d40da8 100644
--- a/llvm_mode/afl-llvm-lto-whitelist.so.cc
+++ b/llvm_mode/afl-llvm-lto-whitelist.so.cc
@@ -36,6 +36,7 @@
 #include <string>
 #include <fstream>
 #include <sys/time.h>
+#include <fnmatch.h>
 
 #include "llvm/IR/DebugInfo.h"
 #include "llvm/IR/BasicBlock.h"
@@ -175,9 +176,8 @@ bool AFLwhitelist::runOnModule(Module &M) {
              * specified in the list. */
             if (instFilename.str().length() >= it->length()) {
 
-              if (instFilename.str().compare(
-                      instFilename.str().length() - it->length(), it->length(),
-                      *it) == 0) {
+              if (fnmatch(("*" + *it).c_str(), instFilename.str().c_str(), 0) ==
+                  0) {
 
                 instrumentFunction = true;
                 break;