aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2020-03-11 11:42:57 +0100
committervan Hauser <vh@thc.org>2020-03-11 11:42:57 +0100
commit684f4dd1c44053517c6685a8a3137691535ecd84 (patch)
tree67b729127193050c7812bf2159ffac047b45280d /src
parentd8d89507b5cdbd066c149fd3c86a91b3948521aa (diff)
downloadafl++-684f4dd1c44053517c6685a8a3137691535ecd84.tar.gz
honor afl_quiet on env var checks + code-format
Diffstat (limited to 'src')
-rw-r--r--src/afl-analyze.c2
-rw-r--r--src/afl-common.c8
-rw-r--r--src/afl-fuzz-bitmap.c4
-rw-r--r--src/afl-fuzz-extras.c16
-rw-r--r--src/afl-fuzz-init.c26
-rw-r--r--src/afl-fuzz-mutators.c2
-rw-r--r--src/afl-fuzz-one.c10
-rw-r--r--src/afl-fuzz-python.c2
-rw-r--r--src/afl-fuzz-stats.c14
-rw-r--r--src/afl-gcc.c6
-rw-r--r--src/afl-showmap.c8
11 files changed, 50 insertions, 48 deletions
diff --git a/src/afl-analyze.c b/src/afl-analyze.c
index 3a392da4..2148cdf0 100644
--- a/src/afl-analyze.c
+++ b/src/afl-analyze.c
@@ -824,7 +824,7 @@ static void usage(u8 *argv0) {
static void find_binary(u8 *fname) {
- u8 *env_path = 0;
+ u8 * env_path = 0;
struct stat st;
if (strchr(fname, '/') || !(env_path = getenv("PATH"))) {
diff --git a/src/afl-common.c b/src/afl-common.c
index 71041875..76a538c6 100644
--- a/src/afl-common.c
+++ b/src/afl-common.c
@@ -44,7 +44,7 @@ void detect_file_args(char **argv, u8 *prog_in, u8 *use_stdin) {
#ifdef __GLIBC__
u8 *cwd = getcwd(NULL, 0); /* non portable glibc extension */
#else
- u8 *cwd;
+ u8 * cwd;
char *buf;
long size = pathconf(".", _PC_PATH_MAX);
if ((buf = (char *)malloc((size_t)size)) != NULL) {
@@ -151,7 +151,7 @@ void argv_cpy_free(char **argv) {
char **get_qemu_argv(u8 *own_loc, u8 **target_path_p, int argc, char **argv) {
char **new_argv = ck_alloc(sizeof(char *) * (argc + 4));
- u8 *tmp, *cp = NULL, *rsl, *own_copy;
+ u8 * tmp, *cp = NULL, *rsl, *own_copy;
memcpy(new_argv + 3, argv + 1, (int)(sizeof(char *)) * argc);
@@ -229,7 +229,7 @@ char **get_qemu_argv(u8 *own_loc, u8 **target_path_p, int argc, char **argv) {
char **get_wine_argv(u8 *own_loc, u8 **target_path_p, int argc, char **argv) {
char **new_argv = ck_alloc(sizeof(char *) * (argc + 3));
- u8 *tmp, *cp = NULL, *rsl, *own_copy;
+ u8 * tmp, *cp = NULL, *rsl, *own_copy;
memcpy(new_argv + 2, argv + 1, (int)(sizeof(char *)) * argc);
@@ -324,6 +324,8 @@ char **get_wine_argv(u8 *own_loc, u8 **target_path_p, int argc, char **argv) {
void check_environment_vars(char **envp) {
+ if (be_quiet) return;
+
int index = 0, found = 0;
char *env;
while ((env = envp[index++]) != NULL) {
diff --git a/src/afl-fuzz-bitmap.c b/src/afl-fuzz-bitmap.c
index 96772032..f9f05131 100644
--- a/src/afl-fuzz-bitmap.c
+++ b/src/afl-fuzz-bitmap.c
@@ -461,8 +461,8 @@ u8 *describe_op(afl_state_t *afl, u8 hnb) {
static void write_crash_readme(afl_state_t *afl) {
- u8 *fn = alloc_printf("%s/crashes/README.txt", afl->out_dir);
- s32 fd;
+ u8 * fn = alloc_printf("%s/crashes/README.txt", afl->out_dir);
+ s32 fd;
FILE *f;
fd = open(fn, O_WRONLY | O_CREAT | O_EXCL, 0600);
diff --git a/src/afl-fuzz-extras.c b/src/afl-fuzz-extras.c
index 5cad29ec..ff4c0ae2 100644
--- a/src/afl-fuzz-extras.c
+++ b/src/afl-fuzz-extras.c
@@ -51,9 +51,9 @@ void load_extras_file(afl_state_t *afl, u8 *fname, u32 *min_len, u32 *max_len,
u32 dict_level) {
FILE *f;
- u8 buf[MAX_LINE];
- u8 *lptr;
- u32 cur_line = 0;
+ u8 buf[MAX_LINE];
+ u8 * lptr;
+ u32 cur_line = 0;
f = fopen(fname, "r");
@@ -188,10 +188,10 @@ void load_extras_file(afl_state_t *afl, u8 *fname, u32 *min_len, u32 *max_len,
void load_extras(afl_state_t *afl, u8 *dir) {
- DIR *d;
+ DIR * d;
struct dirent *de;
- u32 min_len = MAX_DICT_FILE, max_len = 0, dict_level = 0;
- u8 *x;
+ u32 min_len = MAX_DICT_FILE, max_len = 0, dict_level = 0;
+ u8 * x;
/* If the name ends with @, extract level and continue. */
@@ -224,8 +224,8 @@ void load_extras(afl_state_t *afl, u8 *dir) {
while ((de = readdir(d))) {
struct stat st;
- u8 *fn = alloc_printf("%s/%s", dir, de->d_name);
- s32 fd;
+ u8 * fn = alloc_printf("%s/%s", dir, de->d_name);
+ s32 fd;
if (lstat(fn, &st) || access(fn, R_OK)) PFATAL("Unable to access '%s'", fn);
diff --git a/src/afl-fuzz-init.c b/src/afl-fuzz-init.c
index 16049bb5..1db5c0ef 100644
--- a/src/afl-fuzz-init.c
+++ b/src/afl-fuzz-init.c
@@ -35,7 +35,7 @@ void bind_to_free_cpu(afl_state_t *afl) {
#if defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__)
cpu_set_t c;
#elif defined(__NetBSD__)
- cpuset_t *c;
+ cpuset_t * c;
#endif
u8 cpu_used[4096] = {0};
@@ -51,7 +51,7 @@ void bind_to_free_cpu(afl_state_t *afl) {
}
#if defined(__linux__)
- DIR *d;
+ DIR * d;
struct dirent *de;
d = opendir("/proc");
@@ -76,7 +76,7 @@ void bind_to_free_cpu(afl_state_t *afl) {
while ((de = readdir(d))) {
- u8 *fn;
+ u8 * fn;
FILE *f;
u8 tmp[MAX_LINE];
u8 has_vmsize = 0;
@@ -275,8 +275,8 @@ cpuset_destroy(c);
void setup_post(afl_state_t *afl) {
void *dh;
- u8 *fn = get_afl_env("AFL_POST_LIBRARY");
- u32 tlen = 6;
+ u8 * fn = get_afl_env("AFL_POST_LIBRARY");
+ u32 tlen = 6;
if (!fn) return;
@@ -319,9 +319,9 @@ static void shuffle_ptrs(afl_state_t *afl, void **ptrs, u32 cnt) {
void read_testcases(afl_state_t *afl) {
struct dirent **nl;
- s32 nl_cnt;
- u32 i;
- u8 *fn1;
+ s32 nl_cnt;
+ u32 i;
+ u8 * fn1;
/* Auto-detect non-in-place resumption attempts. */
@@ -447,8 +447,8 @@ static void check_map_coverage(afl_state_t *afl) {
void perform_dry_run(afl_state_t *afl) {
struct queue_entry *q = afl->queue;
- u32 cal_failures = 0;
- u8 *skip_crashes = get_afl_env("AFL_SKIP_CRASHES");
+ u32 cal_failures = 0;
+ u8 * skip_crashes = get_afl_env("AFL_SKIP_CRASHES");
while (q) {
@@ -872,7 +872,7 @@ void find_timeout(afl_state_t *afl) {
static u8 delete_files(u8 *path, u8 *prefix) {
- DIR *d;
+ DIR * d;
struct dirent *d_ent;
d = opendir(path);
@@ -997,7 +997,7 @@ dir_cleanup_failed:
static void handle_existing_out_dir(afl_state_t *afl) {
FILE *f;
- u8 *fn = alloc_printf("%s/fuzzer_stats", afl->out_dir);
+ u8 * fn = alloc_printf("%s/fuzzer_stats", afl->out_dir);
/* See if the output directory is locked. If yes, bail out. If not,
create a lock that will persist for the lifetime of the process
@@ -1851,7 +1851,7 @@ static void handle_skipreq(int sig) {
void check_binary(afl_state_t *afl, u8 *fname) {
- u8 *env_path = 0;
+ u8 * env_path = 0;
struct stat st;
s32 fd;
diff --git a/src/afl-fuzz-mutators.c b/src/afl-fuzz-mutators.c
index 159b40c3..9071404d 100644
--- a/src/afl-fuzz-mutators.c
+++ b/src/afl-fuzz-mutators.c
@@ -216,7 +216,7 @@ u8 trim_case_custom(afl_state_t *afl, struct queue_entry *q, u8 *in_buf) {
u32 cksum;
- u8 *retbuf = NULL;
+ u8 * retbuf = NULL;
size_t retlen = 0;
afl->mutator->afl_custom_trim(afl, &retbuf, &retlen);
diff --git a/src/afl-fuzz-one.c b/src/afl-fuzz-one.c
index 8e88693c..92210c8b 100644
--- a/src/afl-fuzz-one.c
+++ b/src/afl-fuzz-one.c
@@ -1566,8 +1566,8 @@ custom_mutator_stage:
for (afl->stage_cur = 0; afl->stage_cur < afl->stage_max; ++afl->stage_cur) {
struct queue_entry *target;
- u32 tid;
- u8 *new_buf;
+ u32 tid;
+ u8 * new_buf;
retry_external_pick:
/* Pick a random other queue entry for passing to external API */
@@ -2163,9 +2163,9 @@ retry_splicing:
afl->queued_paths > 1 && afl->queue_cur->len > 1) {
struct queue_entry *target;
- u32 tid, split_at;
- u8 *new_buf;
- s32 f_diff, l_diff;
+ u32 tid, split_at;
+ u8 * new_buf;
+ s32 f_diff, l_diff;
/* First of all, if we've modified in_buf for havoc, let's clean that
up... */
diff --git a/src/afl-fuzz-python.c b/src/afl-fuzz-python.c
index cc565860..595c1ed0 100644
--- a/src/afl-fuzz-python.c
+++ b/src/afl-fuzz-python.c
@@ -43,7 +43,7 @@ int init_py_module(afl_state_t *afl, u8 *module_name) {
afl->py_module = PyImport_Import(py_name);
Py_DECREF(py_name);
- PyObject *py_module = afl->py_module;
+ PyObject * py_module = afl->py_module;
PyObject **py_functions = afl->py_functions;
if (afl->py_module != NULL) {
diff --git a/src/afl-fuzz-stats.c b/src/afl-fuzz-stats.c
index e03018a1..f2f6efb9 100644
--- a/src/afl-fuzz-stats.c
+++ b/src/afl-fuzz-stats.c
@@ -347,9 +347,9 @@ void show_stats(afl_state_t *afl) {
/* Lord, forgive me this. */
- SAYF(SET_G1 bSTG bLT bH bSTOP cCYA
+ SAYF(SET_G1 bSTG bLT bH bSTOP cCYA
" process timing " bSTG bH30 bH5 bH bHB bH bSTOP cCYA
- " overall results " bSTG bH2 bH2 bRT "\n");
+ " overall results " bSTG bH2 bH2 bRT "\n");
if (afl->dumb_mode) {
@@ -429,9 +429,9 @@ void show_stats(afl_state_t *afl) {
" uniq hangs : " cRST "%-6s" bSTG bV "\n",
DTD(cur_ms, afl->last_hang_time), tmp);
- SAYF(bVR bH bSTOP cCYA
+ SAYF(bVR bH bSTOP cCYA
" cycle progress " bSTG bH10 bH5 bH2 bH2 bHB bH bSTOP cCYA
- " map coverage " bSTG bH bHT bH20 bH2 bVL "\n");
+ " map coverage " bSTG bH bHT bH20 bH2 bVL "\n");
/* This gets funny because we want to print several variable-length variables
together, but then cram them into a fixed-width field - so we need to
@@ -460,9 +460,9 @@ void show_stats(afl_state_t *afl) {
SAYF(bSTOP " count coverage : " cRST "%-21s" bSTG bV "\n", tmp);
- SAYF(bVR bH bSTOP cCYA
+ SAYF(bVR bH bSTOP cCYA
" stage progress " bSTG bH10 bH5 bH2 bH2 bX bH bSTOP cCYA
- " findings in depth " bSTG bH10 bH5 bH2 bH2 bVL "\n");
+ " findings in depth " bSTG bH10 bH5 bH2 bH2 bVL "\n");
sprintf(tmp, "%s (%0.02f%%)", DI(afl->queued_favored),
((double)afl->queued_favored) * 100 / afl->queued_paths);
@@ -533,7 +533,7 @@ void show_stats(afl_state_t *afl) {
/* Aaaalmost there... hold on! */
- SAYF(bVR bH cCYA bSTOP
+ SAYF(bVR bH cCYA bSTOP
" fuzzing strategy yields " bSTG bH10 bHT bH10 bH5 bHB bH bSTOP cCYA
" path geometry " bSTG bH5 bH2 bVL "\n");
diff --git a/src/afl-gcc.c b/src/afl-gcc.c
index bb3baf56..b0153b49 100644
--- a/src/afl-gcc.c
+++ b/src/afl-gcc.c
@@ -48,10 +48,10 @@
#include <stdlib.h>
#include <string.h>
-static u8 *as_path; /* Path to the AFL 'as' wrapper */
+static u8 * as_path; /* Path to the AFL 'as' wrapper */
static u8 **cc_params; /* Parameters passed to the real CC */
-static u32 cc_par_cnt = 1; /* Param count, including argv0 */
-static u8 be_quiet, /* Quiet mode */
+static u32 cc_par_cnt = 1; /* Param count, including argv0 */
+static u8 be_quiet, /* Quiet mode */
clang_mode; /* Invoked as afl-clang*? */
/* Try to find our "fake" GNU assembler in AFL_PATH or at the location derived
diff --git a/src/afl-showmap.c b/src/afl-showmap.c
index 0007af4d..0051bbec 100644
--- a/src/afl-showmap.c
+++ b/src/afl-showmap.c
@@ -648,7 +648,7 @@ static void usage(u8 *argv0) {
static void find_binary(afl_forkserver_t *fsrv, u8 *fname) {
- u8 *env_path = 0;
+ u8 * env_path = 0;
struct stat st;
if (strchr(fname, '/') || !(env_path = getenv("PATH"))) {
@@ -928,10 +928,10 @@ int main(int argc, char **argv_orig, char **envp) {
if (in_dir) {
- DIR *dir_in, *dir_out;
+ DIR * dir_in, *dir_out;
struct dirent *dir_ent;
- int done = 0;
- u8 infile[4096], outfile[4096];
+ int done = 0;
+ u8 infile[4096], outfile[4096];
#if !defined(DT_REG)
struct stat statbuf;
#endif