From 05e621c6006206436455528c44df5d2540794082 Mon Sep 17 00:00:00 2001 From: rish9101 Date: Tue, 29 Sep 2020 08:44:13 +0530 Subject: [PATCH] code format --- examples/libaflfuzzer.c | 6 +----- include/input.h | 2 +- include/mutator.h | 2 +- src/input.c | 7 +++++-- src/mutator.c | 6 ++++-- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/examples/libaflfuzzer.c b/examples/libaflfuzzer.c index c6676f0..c7ed034 100644 --- a/examples/libaflfuzzer.c +++ b/examples/libaflfuzzer.c @@ -803,11 +803,7 @@ bool broker_message_hook(llmp_broker_t *broker, llmp_broker_clientdata_t *client int main(int argc, char **argv) { - if (argc < 4) { - - FATAL("Usage: %s number_of_threads /path/to/input/dir /path/to/queue/dir", argv[0]); - - } + if (argc < 4) { FATAL("Usage: %s number_of_threads /path/to/input/dir /path/to/queue/dir", argv[0]); } s32 i = 0; int status = 0; diff --git a/include/input.h b/include/input.h index ba4d41c..7254bb4 100644 --- a/include/input.h +++ b/include/input.h @@ -52,7 +52,7 @@ struct afl_input { u8 * bytes; // Raw input bytes size_t len; // Length of the input - u8 * copy_buf; + u8 *copy_buf; struct afl_input_funcs funcs; diff --git a/include/mutator.h b/include/mutator.h index bdd7b56..bc61147 100644 --- a/include/mutator.h +++ b/include/mutator.h @@ -55,7 +55,7 @@ struct afl_mutator_funcs { struct afl_mutator { afl_engine_t *engine; - u8 *mutate_buf; // Extra buf for mutators to work with for afl_realloc + u8 * mutate_buf; // Extra buf for mutators to work with for afl_realloc struct afl_mutator_funcs funcs; diff --git a/src/input.c b/src/input.c index 7ae7333..bff96ff 100644 --- a/src/input.c +++ b/src/input.c @@ -58,10 +58,13 @@ afl_ret_t afl_input_init(afl_input_t *input) { void afl_input_deinit(afl_input_t *input) { - /* Deiniting requires a little hack. We free the byte ONLY if copy buf is not NULL. Because then we can assume that the input is in the queue*/ - if (input->bytes && input->copy_buf) { + /* Deiniting requires a little hack. We free the byte ONLY if copy buf is not NULL. Because then we can assume that + * the input is in the queue*/ + if (input->bytes && input->copy_buf) { + free(input->bytes); afl_free(input->copy_buf); + } input->bytes = NULL; diff --git a/src/mutator.c b/src/mutator.c index 5a063d7..06a3115 100644 --- a/src/mutator.c +++ b/src/mutator.c @@ -334,14 +334,16 @@ void afl_mutfunc_clone_bytes(afl_mutator_t *mutator, afl_input_t *input) { mutator->mutate_buf = afl_realloc(mutator->mutate_buf, clone_len + size); - input->bytes = afl_insert_substring(input->bytes, mutator->mutate_buf, size, input->bytes + clone_from, clone_len, clone_to); + input->bytes = + afl_insert_substring(input->bytes, mutator->mutate_buf, size, input->bytes + clone_from, clone_len, clone_to); input->len += clone_len; } else { clone_len = choose_block_len(rand, HAVOC_BLK_XL); - input->bytes = afl_insert_bytes(input->bytes, mutator->mutate_buf, size, afl_rand_below(rand, 255), clone_len, clone_to); + input->bytes = + afl_insert_bytes(input->bytes, mutator->mutate_buf, size, afl_rand_below(rand, 255), clone_len, clone_to); input->len += clone_len;