aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Fioraldi <andreafioraldi@gmail.com>2019-09-18 10:23:36 +0200
committerAndrea Fioraldi <andreafioraldi@gmail.com>2019-09-18 10:23:36 +0200
commit74a984d75f59358d07c8816e4a1329108ca1fd41 (patch)
tree093f6ce31f95d149435cd32fc9cbdda97ce00613
parentb55ea6409dfcadf3c43244fb8e72ea660fd4fcc2 (diff)
downloadafl++-74a984d75f59358d07c8816e4a1329108ca1fd41.tar.gz
code format
-rw-r--r--include/common.h4
-rw-r--r--qemu_mode/patches/afl-qemu-cpu-inl.h1
-rw-r--r--src/afl-analyze.c13
-rw-r--r--src/afl-common.c25
-rw-r--r--src/afl-fuzz.c13
-rw-r--r--src/afl-showmap.c12
-rw-r--r--src/afl-tmin.c13
7 files changed, 45 insertions, 36 deletions
diff --git a/include/common.h b/include/common.h
index c370044e..e13bf0a0 100644
--- a/include/common.h
+++ b/include/common.h
@@ -27,9 +27,9 @@
#define __AFLCOMMON_H
#include "types.h"
-extern u8 *target_path; /* Path to target binary */
+extern u8* target_path; /* Path to target binary */
-void detect_file_args(char **argv, u8 *prog_in);
+void detect_file_args(char** argv, u8* prog_in);
char** get_qemu_argv(u8* own_loc, char** argv, int argc);
char** get_wine_argv(u8* own_loc, char** argv, int argc);
diff --git a/qemu_mode/patches/afl-qemu-cpu-inl.h b/qemu_mode/patches/afl-qemu-cpu-inl.h
index 8b137891..139597f9 100644
--- a/qemu_mode/patches/afl-qemu-cpu-inl.h
+++ b/qemu_mode/patches/afl-qemu-cpu-inl.h
@@ -1 +1,2 @@
+
diff --git a/src/afl-analyze.c b/src/afl-analyze.c
index 3e15ca35..2d13621b 100644
--- a/src/afl-analyze.c
+++ b/src/afl-analyze.c
@@ -760,7 +760,8 @@ static void usage(u8* argv0) {
" -m megs - memory limit for child process (%d MB)\n"
" -Q - use binary-only instrumentation (QEMU mode)\n"
" -U - use unicorn-based instrumentation (Unicorn mode)\n"
- " -W - use qemu-based instrumentation with Wine (Wine mode)\n\n"
+ " -W - use qemu-based instrumentation with Wine (Wine "
+ "mode)\n\n"
"Analysis settings:\n\n"
@@ -834,7 +835,8 @@ static void find_binary(u8* fname) {
int main(int argc, char** argv) {
s32 opt;
- u8 mem_limit_given = 0, timeout_given = 0, qemu_mode = 0, unicorn_mode = 0, use_wine = 0;
+ u8 mem_limit_given = 0, timeout_given = 0, qemu_mode = 0, unicorn_mode = 0,
+ use_wine = 0;
char** use_argv;
doc_path = access(DOC_PATH, F_OK) ? "docs" : DOC_PATH;
@@ -930,7 +932,7 @@ int main(int argc, char** argv) {
unicorn_mode = 1;
break;
- case 'W': /* Wine+QEMU mode */
+ case 'W': /* Wine+QEMU mode */
if (use_wine) FATAL("Multiple -W options not supported");
qemu_mode = 1;
@@ -963,13 +965,14 @@ int main(int argc, char** argv) {
detect_file_args(argv + optind, prog_in);
if (qemu_mode) {
-
+
if (use_wine)
use_argv = get_wine_argv(argv[0], argv + optind, argc - optind);
else
use_argv = get_qemu_argv(argv[0], argv + optind, argc - optind);
-
+
} else
+
use_argv = argv + optind;
SAYF("\n");
diff --git a/src/afl-common.c b/src/afl-common.c
index 0d690831..e753e797 100644
--- a/src/afl-common.c
+++ b/src/afl-common.c
@@ -35,7 +35,7 @@
#include <unistd.h>
#endif
-u8 *target_path; /* Path to target binary */
+u8* target_path; /* Path to target binary */
void detect_file_args(char** argv, u8* prog_in) {
@@ -97,7 +97,6 @@ void detect_file_args(char** argv, u8* prog_in) {
}
-
/* Rewrite argv for QEMU. */
char** get_qemu_argv(u8* own_loc, char** argv, int argc) {
@@ -193,9 +192,9 @@ char** get_wine_argv(u8* own_loc, char** argv, int argc) {
cp = alloc_printf("%s/afl-qemu-trace", tmp);
if (access(cp, X_OK)) FATAL("Unable to find '%s'", tmp);
-
+
ck_free(cp);
-
+
cp = alloc_printf("%s/afl-wine-trace", tmp);
if (access(cp, X_OK)) FATAL("Unable to find '%s'", tmp);
@@ -218,14 +217,14 @@ char** get_wine_argv(u8* own_loc, char** argv, int argc) {
if (!access(cp, X_OK)) {
ck_free(cp);
-
+
cp = alloc_printf("%s/afl-wine-trace", own_copy);
-
+
if (!access(cp, X_OK)) {
target_path = new_argv[0] = cp;
return new_argv;
-
+
}
}
@@ -234,17 +233,17 @@ char** get_wine_argv(u8* own_loc, char** argv, int argc) {
ck_free(own_copy);
- u8 *ncp = BIN_PATH "/afl-qemu-trace";
+ u8* ncp = BIN_PATH "/afl-qemu-trace";
if (!access(ncp, X_OK)) {
-
+
ncp = BIN_PATH "/afl-wine-trace";
-
+
if (!access(ncp, X_OK)) {
target_path = new_argv[0] = ck_strdup(ncp);
return new_argv;
-
+
}
}
@@ -263,10 +262,10 @@ char** get_wine_argv(u8* own_loc, char** argv, int argc) {
" instrumented at compile time with afl-gcc. It is also possible to "
"use it as a\n"
" traditional \"dumb\" fuzzer by specifying '-n' in the command "
- "line.\n", ncp);
+ "line.\n",
+ ncp);
FATAL("Failed to locate '%s'.", ncp);
}
-
diff --git a/src/afl-fuzz.c b/src/afl-fuzz.c
index a2e3c873..027db2f0 100644
--- a/src/afl-fuzz.c
+++ b/src/afl-fuzz.c
@@ -132,8 +132,8 @@ int main(int argc, char** argv) {
gettimeofday(&tv, &tz);
init_seed = tv.tv_sec ^ tv.tv_usec ^ getpid();
- while ((opt = getopt(argc, argv, "+i:o:f:m:t:T:dnCB:S:M:x:QUWe:p:s:V:E:L:h")) >
- 0)
+ while ((opt = getopt(argc, argv,
+ "+i:o:f:m:t:T:dnCB:S:M:x:QUWe:p:s:V:E:L:h")) > 0)
switch (opt) {
@@ -370,8 +370,8 @@ int main(int argc, char** argv) {
if (!mem_limit_given) mem_limit = MEM_LIMIT_UNICORN;
break;
-
- case 'W': /* Wine+QEMU mode */
+
+ case 'W': /* Wine+QEMU mode */
if (use_wine) FATAL("Multiple -W options not supported");
qemu_mode = 1;
@@ -721,13 +721,14 @@ int main(int argc, char** argv) {
start_time = get_cur_time();
if (qemu_mode) {
-
+
if (use_wine)
use_argv = get_wine_argv(argv[0], argv + optind, argc - optind);
else
use_argv = get_qemu_argv(argv[0], argv + optind, argc - optind);
-
+
} else
+
use_argv = argv + optind;
perform_dry_run(use_argv);
diff --git a/src/afl-showmap.c b/src/afl-showmap.c
index 0720a234..31f12856 100644
--- a/src/afl-showmap.c
+++ b/src/afl-showmap.c
@@ -498,8 +498,9 @@ static void find_binary(u8* fname) {
int main(int argc, char** argv) {
s32 opt;
- u8 mem_limit_given = 0, timeout_given = 0, qemu_mode = 0, unicorn_mode = 0, use_wine = 0;
- u32 tcnt = 0;
+ u8 mem_limit_given = 0, timeout_given = 0, qemu_mode = 0, unicorn_mode = 0,
+ use_wine = 0;
+ u32 tcnt = 0;
char** use_argv;
doc_path = access(DOC_PATH, F_OK) ? "docs" : DOC_PATH;
@@ -612,7 +613,7 @@ int main(int argc, char** argv) {
unicorn_mode = 1;
break;
- case 'W': /* Wine+QEMU mode */
+ case 'W': /* Wine+QEMU mode */
if (use_wine) FATAL("Multiple -W options not supported");
qemu_mode = 1;
@@ -671,13 +672,14 @@ int main(int argc, char** argv) {
detect_file_args(argv + optind, at_file);
if (qemu_mode) {
-
+
if (use_wine)
use_argv = get_wine_argv(argv[0], argv + optind, argc - optind);
else
use_argv = get_qemu_argv(argv[0], argv + optind, argc - optind);
-
+
} else
+
use_argv = argv + optind;
run_target(use_argv);
diff --git a/src/afl-tmin.c b/src/afl-tmin.c
index fa9769b1..7f354727 100644
--- a/src/afl-tmin.c
+++ b/src/afl-tmin.c
@@ -934,7 +934,8 @@ static void usage(u8* argv0) {
" -m megs - memory limit for child process (%d MB)\n"
" -Q - use binary-only instrumentation (QEMU mode)\n"
" -U - use unicorn-based instrumentation (Unicorn mode)\n"
- " -W - use qemu-based instrumentation with Wine (Wine mode)\n\n"
+ " -W - use qemu-based instrumentation with Wine (Wine "
+ "mode)\n\n"
" (Not necessary, here for consistency with other afl-* "
"tools)\n\n"
@@ -1025,7 +1026,8 @@ static void read_bitmap(u8* fname) {
int main(int argc, char** argv) {
s32 opt;
- u8 mem_limit_given = 0, timeout_given = 0, qemu_mode = 0, unicorn_mode = 0, use_wine = 0;
+ u8 mem_limit_given = 0, timeout_given = 0, qemu_mode = 0, unicorn_mode = 0,
+ use_wine = 0;
char** use_argv;
doc_path = access(DOC_PATH, F_OK) ? "docs" : DOC_PATH;
@@ -1133,7 +1135,7 @@ int main(int argc, char** argv) {
unicorn_mode = 1;
break;
- case 'W': /* Wine+QEMU mode */
+ case 'W': /* Wine+QEMU mode */
if (use_wine) FATAL("Multiple -W options not supported");
qemu_mode = 1;
@@ -1184,13 +1186,14 @@ int main(int argc, char** argv) {
detect_file_args(argv + optind, out_file);
if (qemu_mode) {
-
+
if (use_wine)
use_argv = get_wine_argv(argv[0], argv + optind, argc - optind);
else
use_argv = get_qemu_argv(argv[0], argv + optind, argc - optind);
-
+
} else
+
use_argv = argv + optind;
exact_mode = !!getenv("AFL_TMIN_EXACT");