aboutsummaryrefslogtreecommitdiff
path: root/afl-cmin
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2020-02-19 16:52:40 +0100
committervan Hauser <vh@thc.org>2020-02-19 16:52:40 +0100
commit42af8ee0597cc01885b5c0b5a7556b3aaecd826b (patch)
treebd2fd315d1c591f8854f7885eb9588a83f6ceceb /afl-cmin
parented4a70c6189a4670bcb8a20c4ec0a82245a4c017 (diff)
downloadAFLplusplus-42af8ee0597cc01885b5c0b5a7556b3aaecd826b.tar.gz
afl-cmin bugfix if -o exists
Diffstat (limited to 'afl-cmin')
-rwxr-xr-xafl-cmin9
1 files changed, 5 insertions, 4 deletions
diff --git a/afl-cmin b/afl-cmin
index 1dd67fbe..9570bc93 100755
--- a/afl-cmin
+++ b/afl-cmin
@@ -287,7 +287,8 @@ BEGIN {
system("rm -rf "trace_dir" 2>/dev/null");
system("rm "out_dir"/id[:_]* 2>/dev/null")
- if (0 == system( "test -d "out_dir" -a -e "out_dir"/*" )) {
+ "ls "out_dir"/* 2>/dev/null | wc -l" | getline noofentries
+ if (0 == system( "test -d "out_dir" -a "noofentries" -gt 0" )) {
print "[-] Error: directory '"out_dir"' exists and is not empty - delete it first." > "/dev/stderr"
exit 1
}
@@ -318,7 +319,7 @@ BEGIN {
print "[-] Error: can't find 'afl-showmap' - please set AFL_PATH." > "/dev/stderr"
exit 1
}
-
+
# get list of input filenames sorted by size
i = 0
# yuck, gnu stat is option incompatible to bsd stat
@@ -392,10 +393,10 @@ BEGIN {
cur = 0;
if (!stdin_file) {
- printf " Processing "in_count" files (forkserver mode)..."
+ print " Processing "in_count" files (forkserver mode)..."
system( "AFL_CMIN_ALLOW_ANY=1 \""showmap"\" -m "mem_limit" -t "timeout" -o \""trace_dir"\" -Z "extra_par" -i \""in_dir"\" -- \""target_bin"\" "prog_args_string)
} else {
- printf " Processing "in_count" files (forkserver mode)..."
+ print " Processing "in_count" files (forkserver mode)..."
system( "AFL_CMIN_ALLOW_ANY=1 \""showmap"\" -m "mem_limit" -t "timeout" -o \""trace_dir"\" -Z "extra_par" -i \""in_dir"\" -- \""target_bin"\" "prog_args_string" </dev/null")
}