Skip to content

Commit 2eeba2d

Browse files
committed
code format
1 parent 09123d8 commit 2eeba2d

File tree

5 files changed

+19
-12
lines changed

5 files changed

+19
-12
lines changed

include/forkserver.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ typedef struct {
7070
enum NyxReturnValue (*nyx_exec)(void *qemu_process);
7171
uint8_t *(*nyx_get_bitmap_buffer)(void *qemu_process);
7272
size_t (*nyx_get_bitmap_buffer_size)(void *qemu_process);
73-
uint32_t (*nyx_get_aux_string)(void *nyx_process, uint8_t *buffer, uint32_t size);
73+
uint32_t (*nyx_get_aux_string)(void *nyx_process, uint8_t *buffer,
74+
uint32_t size);
7475

7576
} nyx_plugin_handler_t;
7677

@@ -174,7 +175,7 @@ typedef struct afl_forkserver {
174175
void * nyx_runner; /* nyx runner object */
175176
u32 nyx_id; /* nyx runner id (0 -> master) */
176177
u32 nyx_bind_cpu_id; /* nyx runner cpu id */
177-
char* nyx_aux_string;
178+
char * nyx_aux_string;
178179
#endif
179180

180181
} afl_forkserver_t;

nyx_mode/custom_harness/example.c

+4-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#define TRACE_BUFFER_SIZE (64)
88

99
#define PAGE_SIZE 0x1000
10-
#define MMAP_SIZE(x) ((x & ~(PAGE_SIZE-1)) + PAGE_SIZE)
10+
#define MMAP_SIZE(x) ((x & ~(PAGE_SIZE - 1)) + PAGE_SIZE)
1111

1212
int main(int argc, char **argv) {
1313

@@ -30,8 +30,9 @@ int main(int argc, char **argv) {
3030
/* this is our "bitmap" that is later shared with the fuzzer (you can also
3131
* pass the pointer of the bitmap used by compile-time instrumentations in
3232
* your target) */
33-
uint8_t *trace_buffer = mmap(NULL, MMAP_SIZE(TRACE_BUFFER_SIZE), PROT_READ |
34-
PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, -1, 0);
33+
uint8_t *trace_buffer =
34+
mmap(NULL, MMAP_SIZE(TRACE_BUFFER_SIZE), PROT_READ | PROT_WRITE,
35+
MAP_SHARED | MAP_ANONYMOUS, -1, 0);
3536
memset(trace_buffer, 0,
3637
TRACE_BUFFER_SIZE); // makes sure that the bitmap buffer is already
3738
// mapped into the guest's memory (alternatively

src/afl-forkserver.c

+4-1
Original file line numberDiff line numberDiff line change
@@ -1257,9 +1257,12 @@ void afl_fsrv_kill(afl_forkserver_t *fsrv) {
12571257

12581258
#ifdef __linux__
12591259
if (fsrv->nyx_mode) {
1260+
12601261
free(fsrv->nyx_aux_string);
1261-
fsrv->nyx_handlers->nyx_shutdown(fsrv->nyx_runner);
1262+
fsrv->nyx_handlers->nyx_shutdown(fsrv->nyx_runner);
1263+
12621264
}
1265+
12631266
#endif
12641267

12651268
}

src/afl-fuzz-bitmap.c

+7-4
Original file line numberDiff line numberDiff line change
@@ -772,19 +772,22 @@ save_if_interesting(afl_state_t *afl, void *mem, u32 len, u8 fault) {
772772
close(fd);
773773

774774
#ifdef __linux__
775-
if(afl->fsrv.nyx_mode && fault == FSRV_RUN_CRASH) {
776-
u8 fn_log[PATH_MAX];
775+
if (afl->fsrv.nyx_mode && fault == FSRV_RUN_CRASH) {
777776

778-
snprintf(fn_log, PATH_MAX, "%s.log", fn);
777+
u8 fn_log[PATH_MAX];
779778

779+
snprintf(fn_log, PATH_MAX, "%s.log", fn);
780780
fd = open(fn_log, O_WRONLY | O_CREAT | O_EXCL, DEFAULT_PERMISSION);
781781
if (unlikely(fd < 0)) { PFATAL("Unable to create '%s'", fn_log); }
782782

783-
u32 nyx_aux_string_len = afl->fsrv.nyx_handlers->nyx_get_aux_string(afl->fsrv.nyx_runner, afl->fsrv.nyx_aux_string, 0x1000);
783+
u32 nyx_aux_string_len = afl->fsrv.nyx_handlers->nyx_get_aux_string(
784+
afl->fsrv.nyx_runner, afl->fsrv.nyx_aux_string, 0x1000);
784785

785786
ck_write(fd, afl->fsrv.nyx_aux_string, nyx_aux_string_len, fn_log);
786787
close(fd);
788+
787789
}
790+
788791
#endif
789792

790793
return keeping;

src/afl-fuzz.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -468,8 +468,7 @@ nyx_plugin_handler_t *afl_load_libnyx_plugin(u8 *libnyx_binary) {
468468
dlsym(handle, "nyx_get_bitmap_buffer_size");
469469
if (plugin->nyx_get_bitmap_buffer_size == NULL) { goto fail; }
470470

471-
plugin->nyx_get_aux_string =
472-
dlsym(handle, "nyx_get_aux_string");
471+
plugin->nyx_get_aux_string = dlsym(handle, "nyx_get_aux_string");
473472
if (plugin->nyx_get_aux_string == NULL) { goto fail; }
474473

475474
OKF("libnyx plugin is ready!");

0 commit comments

Comments
 (0)