diff options
author | van Hauser <vh@thc.org> | 2020-12-10 17:25:22 +0100 |
---|---|---|
committer | van Hauser <vh@thc.org> | 2020-12-10 17:25:22 +0100 |
commit | 161c80014ec11e8ae4338da34428c20dcbe03962 (patch) | |
tree | edbce12f99291a82f79291894b2da813275d35b0 /afl-cmin | |
parent | af403e5872f9ed640e3148105b6731c9a8f48225 (diff) | |
download | afl++-161c80014ec11e8ae4338da34428c20dcbe03962.tar.gz |
change search order for afl-showmin in afl-cmin*
Diffstat (limited to 'afl-cmin')
-rwxr-xr-x | afl-cmin | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/afl-cmin b/afl-cmin index 93174b8b..292d9d9d 100755 --- a/afl-cmin +++ b/afl-cmin @@ -120,7 +120,7 @@ function usage() { "AFL_CRASH_EXITCODE: optional child exit code to be interpreted as crash\n" \ "AFL_FORKSRV_INIT_TMOUT: time the fuzzer waits for the target to come up, initially\n" \ "AFL_KEEP_TRACES: leave the temporary <out_dir>/.traces directory\n" \ -"AFL_PATH: path for the afl-showmap binary\n" \ +"AFL_PATH: path for the afl-showmap binary if not found anywhere else\n" \ "AFL_SKIP_BIN_CHECK: skip check for target binary\n" exit 1 } @@ -313,14 +313,18 @@ BEGIN { close( stdin_file ) } - if (!ENVIRON["AFL_PATH"]) { - if (0 == system("test -f afl-cmin")) { + # First we look in PATH + if (0 == system("command -v afl-showmap >/dev/null 2>&1")) { + "command -v afl-showmap 2>/dev/null" | getline showmap + } else { + # then we look in the current directory + if (0 == system("test -x ./afl-showmap")) { showmap = "./afl-showmap" } else { - "command -v afl-showmap 2>/dev/null" | getline showmap + if (ENVIRON["AFL_PATH"]) { + showmap = ENVIRON["AFL_PATH"] "/afl-showmap" + } } - } else { - showmap = ENVIRON["AFL_PATH"] "/afl-showmap" } if (!showmap || 0 != system("test -x "showmap )) { |