diff options
author | Thomas Rooijakkers <thomas.rooijakkers@tno.nl> | 2020-09-04 16:02:09 +0200 |
---|---|---|
committer | Thomas Rooijakkers <thomas.rooijakkers@tno.nl> | 2020-09-04 16:02:09 +0200 |
commit | 809a7cffe2de74b048143f0820fa922c9a18aff5 (patch) | |
tree | 5b09fd298846bffeaa2751d9a2f1fd47e46e5fa7 /src | |
parent | 6adaacbb3aed2f967b4f3aeacdc41e91502914b3 (diff) | |
download | afl++-809a7cffe2de74b048143f0820fa922c9a18aff5.tar.gz |
Write set environment variables in an env file style.
Diffstat (limited to 'src')
-rw-r--r-- | src/afl-fuzz-stats.c | 27 | ||||
-rw-r--r-- | src/afl-fuzz.c | 2 |
2 files changed, 7 insertions, 22 deletions
diff --git a/src/afl-fuzz-stats.c b/src/afl-fuzz-stats.c index 45b1326c..298ad229 100644 --- a/src/afl-fuzz-stats.c +++ b/src/afl-fuzz-stats.c @@ -48,39 +48,24 @@ FILE *open_file(const char *fn) { /* Write fuzzer setup file */ -void write_fuzzer_setup_file(afl_state_t *afl) { +void write_fuzzer_config_file(afl_state_t *afl) { u8 fn[PATH_MAX]; FILE *f; - snprintf(fn, PATH_MAX, "%s/fuzzer_setup", afl->out_dir); + snprintf(fn, PATH_MAX, "%s/fuzzer_config", afl->out_dir); f = open_file(fn); - char * val; - uint32_t i = 0; + char *val; + uint32_t s_afl_env = sizeof(afl_environment_variables) / sizeof(afl_environment_variables[0]) - 1; - - uint32_t max_len = 0; - uint32_t cur_len = 0; - for (i = 0; i < s_afl_env; i++) { - - if ((val = getenv(afl_environment_variables[i])) != NULL) { - - cur_len = strlen(afl_environment_variables[i]); - max_len = cur_len > max_len ? cur_len : max_len; - - } - - } - - for (i = 0; i < s_afl_env; i++) { + for (uint32_t i = 0; i < s_afl_env; i++) { if ((val = getenv(afl_environment_variables[i])) != NULL) { - fprintf(f, "%*.*s : %s\n", -max_len, strlen(afl_environment_variables[i]), - afl_environment_variables[i], val); + fprintf(f, "%s=%s\n", afl_environment_variables[i], val); } diff --git a/src/afl-fuzz.c b/src/afl-fuzz.c index ae060b07..e9ea8b62 100644 --- a/src/afl-fuzz.c +++ b/src/afl-fuzz.c @@ -1274,7 +1274,7 @@ int main(int argc, char **argv_orig, char **envp) { seek_to = find_start_position(afl); - write_fuzzer_setup_file(afl); + write_fuzzer_config_file(afl); write_stats_file(afl, 0, 0, 0); maybe_update_plot_file(afl, 0, 0); save_auto(afl); |