diff options
author | van Hauser <vh@thc.org> | 2023-03-06 11:51:56 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-06 11:51:56 +0100 |
commit | aa125f824619fe3c3ebf5ed8a571340397a7c46a (patch) | |
tree | de55616a3066713895853fc8e7751e4c59af9f6c /src/afl-fuzz-state.c | |
parent | 2f128e0dbd1b39f1d99a042f8813b93da1747731 (diff) | |
parent | b571e88bd33ad7b5cf7dade93e6a1986cf8def56 (diff) | |
download | afl++-aa125f824619fe3c3ebf5ed8a571340397a7c46a.tar.gz |
Merge pull request #1667 from amitelka/feature/opt_statsfile_update_interval
Added env variable to allow custom interval update of fuzzer_stats file
Diffstat (limited to 'src/afl-fuzz-state.c')
-rw-r--r-- | src/afl-fuzz-state.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/afl-fuzz-state.c b/src/afl-fuzz-state.c index 6d8c8758..f9aa5cfe 100644 --- a/src/afl-fuzz-state.c +++ b/src/afl-fuzz-state.c @@ -24,6 +24,7 @@ */ #include <signal.h> +#include <limits.h> #include "afl-fuzz.h" #include "envs.h" @@ -100,6 +101,7 @@ void afl_state_init(afl_state_t *afl, uint32_t map_size) { afl->hang_tmout = EXEC_TIMEOUT; afl->exit_on_time = 0; afl->stats_update_freq = 1; + afl->stats_file_update_freq_msecs = STATS_UPDATE_SEC * 1000; afl->stats_avg_exec = 0; afl->skip_deterministic = 1; afl->sync_time = SYNC_TIME; @@ -565,6 +567,26 @@ void read_afl_environment(afl_state_t *afl, char **envp) { } + } else if (!strncmp(env, "AFL_FUZZER_STATS_UPDATE_INTERVAL", + + afl_environment_variable_len)) { + + u64 stats_update_freq_sec = + strtoull(get_afl_env(afl_environment_variables[i]), NULL, 0); + if (stats_update_freq_sec >= UINT_MAX || + 0 == stats_update_freq_sec) { + + WARNF( + "Incorrect value given to AFL_FUZZER_STATS_UPDATE_INTERVAL, " + "using default of %d seconds\n", + STATS_UPDATE_SEC); + + } else { + + afl->stats_file_update_freq_msecs = stats_update_freq_sec * 1000; + + } + } } else { |