mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-11 01:31:37 +00:00
Write set environment variables in an env file style.
This commit is contained in:
parent
6adaacbb3a
commit
809a7cffe2
@ -946,7 +946,7 @@ void destroy_extras(afl_state_t *);
|
||||
/* Stats */
|
||||
|
||||
FILE *open_file(const char *);
|
||||
void write_fuzzer_setup_file(afl_state_t *);
|
||||
void write_fuzzer_config_file(afl_state_t *);
|
||||
void write_stats_file(afl_state_t *, double, double, double);
|
||||
void maybe_update_plot_file(afl_state_t *, double, double);
|
||||
void show_stats(afl_state_t *);
|
||||
|
@ -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++) {
|
||||
for (uint32_t 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++) {
|
||||
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user