change search order for afl-showmin in afl-cmin*
MODIFY
README.md
README.md
@@ -57,6 +57,8 @@ behaviours and defaults:
`AFL_TESTCACHE_SIZE` (in MB). Good values are between 50-500 (default: 50).
* examples/ got renamed to utils/
* libtokencap/ libdislocator/ and qdbi_mode/ were moved to utils/
+ * afl-cmin/afl-cmin.bash now search first in PATH and last in AFL_PATH
+
## Contents

MODIFY
afl-cmin
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,15 +313,19 @@ BEGIN {
close( stdin_file )
}
- if (!ENVIRON["AFL_PATH"]) {
- if (0 == system("test -f afl-cmin")) {
- showmap = "./afl-showmap"
- } else {
+ # 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 {
+ if (ENVIRON["AFL_PATH"]) {
showmap = ENVIRON["AFL_PATH"] "/afl-showmap"
}
+ }
+ }
if (!showmap || 0 != system("test -x "showmap )) {
print "[-] Error: can't find 'afl-showmap' - please set AFL_PATH." > "/dev/stderr"

MODIFY
afl-cmin.bash
afl-cmin.bash
@@ -132,7 +132,7 @@ For additional tips, please consult README.md.
Environment variables used:
AFL_KEEP_TRACES: leave the temporary <out_dir>\.traces directory
-AFL_PATH: path for the afl-showmap binary
+AFL_PATH: last resort location to find the afl-showmap binary
AFL_SKIP_BIN_CHECK: skip check for target binary
_EOF_
exit 1
@@ -244,11 +244,22 @@ if [ ! "$STDIN_FILE" = "" ]; then
touch "$STDIN_FILE" || exit 1
fi
-if [ "$AFL_PATH" = "" ]; then
- SHOWMAP="${0%/afl-cmin.bash}/afl-showmap"
+SHOWMAP=`command -v afl-showmap 2>/dev/null`
+
+if [ -z "$SHOWMAP" ]; then
+ TMP="${0%/afl-cmin.bash}/afl-showmap"
+ if [ -x "$TMP" ]; then
+ SHOWMAP=$TMP
+ fi
+fi
+
+if [ -z "$SHOWMAP" -a -x "./afl-showmap" ]; then
+ SHOWMAP="./afl-showmap"
else
+ if [ -n "$AFL_PATH" ]; then
SHOWMAP="$AFL_PATH/afl-showmap"
fi
+fi
if [ ! -x "$SHOWMAP" ]; then
echo "[-] Error: can't find 'afl-showmap' - please set AFL_PATH." 1>&2

MODIFY
docs/Changelog.md
docs/Changelog.md
@@ -64,6 +64,7 @@ sending a mail to <afl-users+subscribe@googlegroups.com>.
- added INTROSPECTION support for custom modules
- python fuzz function was not optional, fixed
- some python mutator speed improvements
+ - afl-cmin/afl-cmin.bash now search first in PATH and last in AFL_PATH
- unicornafl synced with upstream version 1.02 (fixes, better rust bindings)
- renamed AFL_DEBUG_CHILD_OUTPUT to AFL_DEBUG_CHILD
- added AFL_CRASH_EXITCODE env variable to treat a child exitcode as crash

change search order for afl-showmin in afl-cmin*