Skip to content
This repository has been archived by the owner on Apr 30, 2021. It is now read-only.

Commit

Permalink
code format
Browse files Browse the repository at this point in the history
  • Loading branch information
rish9101 committed Sep 29, 2020
1 parent e12f6f6 commit 05e621c
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
6 changes: 1 addition & 5 deletions examples/libaflfuzzer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion include/input.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion include/mutator.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
7 changes: 5 additions & 2 deletions src/input.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 4 additions & 2 deletions src/mutator.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 05e621c

Please sign in to comment.