code-format - and afl-cmin/afl-showmap was fixed in the bugfix for afl-tmin

This commit is contained in:
van Hauser
2020-03-10 06:54:31 +01:00
parent 1467776a3f
commit 38d9aedb26
7 changed files with 36 additions and 31 deletions

View File

@ -38,7 +38,7 @@
extern u8 be_quiet;
void detect_file_args(char** argv, u8* prog_in, u8 *use_stdin) {
void detect_file_args(char** argv, u8* prog_in, u8* use_stdin) {
u32 i = 0;
#ifdef __GLIBC__
@ -58,6 +58,7 @@ void detect_file_args(char** argv, u8* prog_in, u8 *use_stdin) {
PFATAL("getcwd() failed");
}
#endif
if (!cwd) PFATAL("getcwd() failed");
@ -103,18 +104,18 @@ void detect_file_args(char** argv, u8* prog_in, u8 *use_stdin) {
}
ck_free(cwd); /* not tracked */
ck_free(cwd); /* not tracked */
}
/* duplicate the system argv so that
/* duplicate the system argv so that
we can edit (and free!) it later */
char **argv_cpy_dup(int argc, char** argv) {
char** argv_cpy_dup(int argc, char** argv) {
u32 i = 0;
char **ret = ck_alloc((argc + 1) * sizeof(char *));
char** ret = ck_alloc((argc + 1) * sizeof(char*));
for (i = 0; i < argc; i++) {
@ -128,19 +129,22 @@ char **argv_cpy_dup(int argc, char** argv) {
}
/* frees all args in the given argv,
/* frees all args in the given argv,
previously created by argv_cpy_dup */
void argv_cpy_free(char **argv) {
void argv_cpy_free(char** argv) {
u32 i = 0;
while (argv[i]) {
u32 i=0;
while(argv[i]) {
ck_free(argv[i]);
i++;
}
ck_free(argv);
}
}
ck_free(argv);
}
/* Rewrite argv for QEMU. */
@ -360,7 +364,7 @@ char* get_afl_env(char* env) {
if ((val = getenv(env)) != NULL)
if (!be_quiet)
OKF("Loaded environment variable %s with value %s\n", env, val);
OKF("Loaded environment variable %s with value %s", env, val);
return val;

View File

@ -135,7 +135,8 @@ void handle_timeout(int sig) {
void afl_fsrv_init(afl_forkserver_t *fsrv) {
// this structure needs default so we initialize it if this was not done already
// this structure needs default so we initialize it if this was not done
// already
if (!fsrv->use_stdin) {
@ -150,9 +151,9 @@ void afl_fsrv_init(afl_forkserver_t *fsrv) {
fsrv->mem_limit = MEM_LIMIT;
fsrv->child_pid = -1;
fsrv->out_dir_fd = -1;
}
list_append(&fsrv_list, fsrv);
}

View File

@ -455,7 +455,7 @@ u8 run_cmplog_target(afl_state_t *afl, u32 timeout) {
setenv("___AFL_EINS_ZWEI_POLIZEI___", "1", 1);
if (!afl->qemu_mode && afl->argv[0] != afl->cmplog_binary) {
ck_free(afl->argv[0]);
afl->argv[0] = afl->cmplog_binary;

View File

@ -373,7 +373,7 @@ void read_testcases(afl_state_t* afl) {
u8 passed_det = 0;
ck_free(nl[i]); /* not tracked */
ck_free(nl[i]); /* not tracked */
if (lstat(fn2, &st) || access(fn2, R_OK))
PFATAL("Unable to access '%s'", fn2);
@ -404,7 +404,7 @@ void read_testcases(afl_state_t* afl) {
}
ck_free(nl); /* not tracked */
ck_free(nl); /* not tracked */
if (!afl->queued_paths) {

View File

@ -237,7 +237,7 @@ int main(int argc, char** argv_orig, char** envp) {
struct timeval tv;
struct timezone tz;
char **argv = argv_cpy_dup(argc, argv_orig);
char** argv = argv_cpy_dup(argc, argv_orig);
afl_state_t* afl = calloc(1, sizeof(afl_state_t));
if (!afl) { FATAL("Could not create afl state"); }

View File

@ -61,9 +61,9 @@
u8 be_quiet;
char*stdin_file; /* stdin file */
char* stdin_file; /* stdin file */
u8 *in_dir, /* input folder */
u8 *in_dir, /* input folder */
*doc_path, /* Path to docs */
*at_file = NULL; /* Substitution string for @@ */
@ -147,7 +147,7 @@ static void at_exit_handler(void) {
/* Write results. */
static u32 write_results_to_file(afl_forkserver_t* fsrv, u8 *outfile) {
static u32 write_results_to_file(afl_forkserver_t* fsrv, u8* outfile) {
s32 fd;
u32 i, ret = 0;
@ -167,7 +167,7 @@ static u32 write_results_to_file(afl_forkserver_t* fsrv, u8 *outfile) {
} else {
unlink(outfile); /* Ignore errors */
unlink(outfile); /* Ignore errors */
fd = open(outfile, O_WRONLY | O_CREAT | O_EXCL, 0600);
if (fd < 0) PFATAL("Unable to create '%s'", outfile);
@ -710,11 +710,11 @@ int main(int argc, char** argv_orig, char** envp) {
s32 opt, i;
u8 mem_limit_given = 0, timeout_given = 0, unicorn_mode = 0, use_wine = 0;
u32 tcnt = 0;
char **use_argv;
char** use_argv;
char **argv = argv_cpy_dup(argc, argv_orig);
char** argv = argv_cpy_dup(argc, argv_orig);
afl_forkserver_t fsrv_var = {0};
afl_forkserver_t fsrv_var = {0};
afl_forkserver_t* fsrv = &fsrv_var;
afl_fsrv_init(fsrv);
@ -962,7 +962,7 @@ int main(int argc, char** argv_orig, char** envp) {
if (fsrv->out_fd < 0) PFATAL("Unable to create '%s'", fsrv->out_file);
if (arg_offset && argv[arg_offset] != stdin_file) {
ck_free(argv[arg_offset]);
argv[arg_offset] = strdup(stdin_file);

View File

@ -1092,11 +1092,11 @@ int main(int argc, char** argv_orig, char** envp) {
s32 opt;
u8 mem_limit_given = 0, timeout_given = 0, unicorn_mode = 0, use_wine = 0;
char **use_argv;
char** use_argv;
char **argv = argv_cpy_dup(argc, argv_orig);
char** argv = argv_cpy_dup(argc, argv_orig);
afl_forkserver_t fsrv_var = {0};
afl_forkserver_t fsrv_var = {0};
afl_forkserver_t* fsrv = &fsrv_var;
afl_fsrv_init(fsrv);