diff options
-rwxr-xr-x | afl-cmin | 13 | ||||
-rw-r--r-- | examples/custom_mutators/example.c | 4 |
2 files changed, 13 insertions, 4 deletions
diff --git a/afl-cmin b/afl-cmin index 28d8c746..ea57015e 100755 --- a/afl-cmin +++ b/afl-cmin @@ -397,10 +397,19 @@ BEGIN { cur = 0; if (!stdin_file) { 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) + retval = 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 { 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") + retval = 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") + } + + if (retval) { + print "[!]Exit code != 0 received from afl-showmap, terminating..." + + if (!ENVIRON["AFL_KEEP_TRACES"]) { + system("rm -rf "trace_dir" 2>/dev/null") + } + exit retval } ####################################################### diff --git a/examples/custom_mutators/example.c b/examples/custom_mutators/example.c index 63e4d6da..63201e23 100644 --- a/examples/custom_mutators/example.c +++ b/examples/custom_mutators/example.c @@ -53,7 +53,7 @@ size_t afl_custom_fuzz(uint8_t *buf, size_t buf_size, // Mutate the payload of the packet for (int i = 3; i < mutated_size; i++) { - mutated_out[i] = (data[i] + rand() % 10) & 0xff; + mutated_out[i] = (buf[i] + rand() % 10) & 0xff; } @@ -90,7 +90,7 @@ size_t afl_custom_pre_save(uint8_t *buf, size_t buf_size, uint8_t **out_buf) { } uint8_t *trim_buf; -size_t trim_buf_size +size_t trim_buf_size; int trimmming_steps; int cur_step; |