about summary refs log tree commit diff
path: root/llvm_mode/afl-llvm-common.cc
diff options
context:
space:
mode:
authorSebastian Ă–sterlund <s.osterlund@vu.nl>2020-05-29 15:47:34 +0200
committerSebastian Ă–sterlund <s.osterlund@vu.nl>2020-05-29 15:47:34 +0200
commit8bb0232ace731c596e9e4e083a048784e35221cd (patch)
tree5597bd138505eb931c26b05d0dbd8d77bba70a7f /llvm_mode/afl-llvm-common.cc
parent84df805ed3e14fb42f0c02420d6ae538a427fa2f (diff)
downloadafl++-8bb0232ace731c596e9e4e083a048784e35221cd.tar.gz
Remove AFL_LLVM_WHITELIST_FNMATCH env variable
Diffstat (limited to 'llvm_mode/afl-llvm-common.cc')
-rw-r--r--llvm_mode/afl-llvm-common.cc36
1 files changed, 8 insertions, 28 deletions
diff --git a/llvm_mode/afl-llvm-common.cc b/llvm_mode/afl-llvm-common.cc
index 76de1d0f..6c7222cd 100644
--- a/llvm_mode/afl-llvm-common.cc
+++ b/llvm_mode/afl-llvm-common.cc
@@ -147,29 +147,19 @@ bool isInWhitelist(llvm::Function *F) {
     /* Continue only if we know where we actually are */
     if (!instFilename.str().empty()) {
 
-      char *enable_fnmatch = getenv("AFL_LLVM_WHITELIST_FNMATCH");
-
       for (std::list<std::string>::iterator it = myWhitelist.begin();
            it != myWhitelist.end(); ++it) {
 
         /* We don't check for filename equality here because
          * filenames might actually be full paths. Instead we
          * check that the actual filename ends in the filename
-         * specified in the list. Enable UNIX-style pattern
-         * matching if AFL_LLVM_WHITELIST_FNMATCH is set */
+         * specified in the list. We also allow UNIX-style pattern
+         * matching */
 
         if (instFilename.str().length() >= it->length()) {
 
-          if (enable_fnmatch &&
-              fnmatch((*it).c_str(), instFilename.str().c_str(), 0) == 0) {
-
-            return true;
-
-          } else if (!enable_fnmatch &&
-
-                     instFilename.str().compare(
-                         instFilename.str().length() - it->length(),
-                         it->length(), *it) == 0) {
+          if (fnmatch(("*" + *it).c_str(), instFilename.str().c_str(), 0) ==
+              0) {
 
             return true;
 
@@ -195,29 +185,19 @@ bool isInWhitelist(llvm::Function *F) {
     /* Continue only if we know where we actually are */
     if (!instFilename.str().empty()) {
 
-      char *enable_fnmatch = getenv("AFL_LLVM_WHITELIST_FNMATCH");
-
       for (std::list<std::string>::iterator it = myWhitelist.begin();
            it != myWhitelist.end(); ++it) {
 
         /* We don't check for filename equality here because
          * filenames might actually be full paths. Instead we
          * check that the actual filename ends in the filename
-         * specified in the list. Enable UNIX-style pattern
-         * matching if AFL_LLVM_WHITELIST_FNMATCH is set */
+         * specified in the list. We also allow UNIX-style pattern
+         * matching */
 
         if (instFilename.str().length() >= it->length()) {
 
-          if (enable_fnmatch &&
-              fnmatch((*it).c_str(), instFilename.str().c_str(), 0) == 0) {
-
-            return true;
-
-          } else if (!enable_fnmatch &&
-
-                     instFilename.str().compare(
-                         instFilename.str().length() - it->length(),
-                         it->length(), *it) == 0) {
+          if (fnmatch(("*" + *it).c_str(), instFilename.str().c_str(), 0) ==
+              0) {
 
             return true;