Skip to content

Commit 2287534

Browse files
Merge branch 'master' of github.com:vanhauser-thc/AFLplusplus
2 parents 27d6d35 + 13429d2 commit 2287534

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

afl-cmin

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,10 +397,19 @@ BEGIN {
397397
cur = 0;
398398
if (!stdin_file) {
399399
print " Processing "in_count" files (forkserver mode)..."
400-
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)
400+
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)
401401
} else {
402402
print " Processing "in_count" files (forkserver mode)..."
403-
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")
403+
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")
404+
}
405+
406+
if (retval) {
407+
print "[!]Exit code != 0 received from afl-showmap, terminating..."
408+
409+
if (!ENVIRON["AFL_KEEP_TRACES"]) {
410+
system("rm -rf "trace_dir" 2>/dev/null")
411+
}
412+
exit retval
404413
}
405414
406415
#######################################################

examples/custom_mutators/example.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ size_t afl_custom_fuzz(uint8_t *buf, size_t buf_size,
5353
// Mutate the payload of the packet
5454
for (int i = 3; i < mutated_size; i++) {
5555

56-
mutated_out[i] = (data[i] + rand() % 10) & 0xff;
56+
mutated_out[i] = (buf[i] + rand() % 10) & 0xff;
5757

5858
}
5959

@@ -90,7 +90,7 @@ size_t afl_custom_pre_save(uint8_t *buf, size_t buf_size, uint8_t **out_buf) {
9090
}
9191

9292
uint8_t *trim_buf;
93-
size_t trim_buf_size
93+
size_t trim_buf_size;
9494
int trimmming_steps;
9595
int cur_step;
9696

0 commit comments

Comments
 (0)