fix reading env vars in afl-fuzz
MODIFY
src/afl-fuzz-globals.c
src/afl-fuzz-globals.c
@@ -148,130 +148,151 @@ void read_afl_environment(afl_state_t *afl, char **envp) {
match = 1;
if (!strncmp(env, "AFL_SKIP_CPUFREQ", afl_environment_variable_len)) {
- afl->afl_env.afl_skip_cpufreq = get_afl_env(env) ? 1 : 0;
+ afl->afl_env.afl_skip_cpufreq =
+ get_afl_env(afl_environment_variables[i]) ? 1 : 0;
} else if (!strncmp(env, "AFL_EXIT_WHEN_DONE",
afl_environment_variable_len)) {
- afl->afl_env.afl_exit_when_done = get_afl_env(env) ? 1 : 0;
+ afl->afl_env.afl_exit_when_done =
+ get_afl_env(afl_environment_variables[i]) ? 1 : 0;
} else if (!strncmp(env, "AFL_NO_AFFINITY",
afl_environment_variable_len)) {
- afl->afl_env.afl_no_affinity = get_afl_env(env) ? 1 : 0;
+ afl->afl_env.afl_no_affinity =
+ get_afl_env(afl_environment_variables[i]) ? 1 : 0;
} else if (!strncmp(env, "AFL_SKIP_CRASHES",
afl_environment_variable_len)) {
- afl->afl_env.afl_skip_crashes = (u8 *)get_afl_env(env);
+ afl->afl_env.afl_skip_crashes =
+ (u8 *)get_afl_env(afl_environment_variables[i]);
} else if (!strncmp(env, "AFL_HANG_TMOUT",
afl_environment_variable_len)) {
- afl->afl_env.afl_hang_tmout = (u8 *)get_afl_env(env);
+ afl->afl_env.afl_hang_tmout =
+ (u8 *)get_afl_env(afl_environment_variables[i]);
} else if (!strncmp(env, "AFL_SKIP_BIN_CHECK",
afl_environment_variable_len)) {
- afl->afl_env.afl_skip_bin_check = get_afl_env(env) ? 1 : 0;
+ afl->afl_env.afl_skip_bin_check =
+ get_afl_env(afl_environment_variables[i]) ? 1 : 0;
} else if (!strncmp(env, "AFL_DUMB_FORKSRV",
afl_environment_variable_len)) {
- afl->afl_env.afl_dumb_forksrv = get_afl_env(env) ? 1 : 0;
+ afl->afl_env.afl_dumb_forksrv =
+ get_afl_env(afl_environment_variables[i]) ? 1 : 0;
} else if (!strncmp(env, "AFL_IMPORT_FIRST",
afl_environment_variable_len)) {
- afl->afl_env.afl_import_first = get_afl_env(env) ? 1 : 0;
+ afl->afl_env.afl_import_first =
+ get_afl_env(afl_environment_variables[i]) ? 1 : 0;
} else if (!strncmp(env, "AFL_CUSTOM_MUTATOR_ONLY",
afl_environment_variable_len)) {
- afl->afl_env.afl_custom_mutator_only = get_afl_env(env) ? 1 : 0;
+ afl->afl_env.afl_custom_mutator_only =
+ get_afl_env(afl_environment_variables[i]) ? 1 : 0;
} else if (!strncmp(env, "AFL_NO_UI", afl_environment_variable_len)) {
- afl->afl_env.afl_no_ui = get_afl_env(env) ? 1 : 0;
+ afl->afl_env.afl_no_ui =
+ get_afl_env(afl_environment_variables[i]) ? 1 : 0;
} else if (!strncmp(env, "AFL_FORCE_UI",
afl_environment_variable_len)) {
- afl->afl_env.afl_force_ui = get_afl_env(env) ? 1 : 0;
+ afl->afl_env.afl_force_ui =
+ get_afl_env(afl_environment_variables[i]) ? 1 : 0;
} else if (!strncmp(env, "AFL_I_DONT_CARE_ABOUT_MISSING_CRASHES",
afl_environment_variable_len)) {
afl->afl_env.afl_i_dont_care_about_missing_crashes =
- get_afl_env(env) ? 1 : 0;
+ get_afl_env(afl_environment_variables[i]) ? 1 : 0;
} else if (!strncmp(env, "AFL_BENCH_JUST_ONE",
afl_environment_variable_len)) {
- afl->afl_env.afl_bench_just_one = get_afl_env(env) ? 1 : 0;
+ afl->afl_env.afl_bench_just_one =
+ get_afl_env(afl_environment_variables[i]) ? 1 : 0;
} else if (!strncmp(env, "AFL_BENCH_UNTIL_CRASH",
afl_environment_variable_len)) {
- afl->afl_env.afl_bench_until_crash = get_afl_env(env) ? 1 : 0;
+ afl->afl_env.afl_bench_until_crash =
+ get_afl_env(afl_environment_variables[i]) ? 1 : 0;
} else if (!strncmp(env, "AFL_DEBUG_CHILD_OUTPUT",
afl_environment_variable_len)) {
- afl->afl_env.afl_debug_child_output = get_afl_env(env) ? 1 : 0;
+ afl->afl_env.afl_debug_child_output =
+ get_afl_env(afl_environment_variables[i]) ? 1 : 0;
} else if (!strncmp(env, "AFL_AUTORESUME",
afl_environment_variable_len)) {
- afl->afl_env.afl_autoresume = get_afl_env(env) ? 1 : 0;
+ afl->afl_env.afl_autoresume =
+ get_afl_env(afl_environment_variables[i]) ? 1 : 0;
} else if (!strncmp(env, "AFL_TMPDIR",
afl_environment_variable_len)) {
- afl->afl_env.afl_tmpdir = (u8 *)get_afl_env(env);
+ afl->afl_env.afl_tmpdir =
+ (u8 *)get_afl_env(afl_environment_variables[i]);
} else if (!strncmp(env, "AFL_POST_LIBRARY",
afl_environment_variable_len)) {
- afl->afl_env.afl_post_library = (u8 *)get_afl_env(env);
+ afl->afl_env.afl_post_library =
+ (u8 *)get_afl_env(afl_environment_variables[i]);
} else if (!strncmp(env, "AFL_CUSTOM_MUTATOR_LIBRARY",
afl_environment_variable_len)) {
- afl->afl_env.afl_custom_mutator_library = (u8 *)get_afl_env(env);
+ afl->afl_env.afl_custom_mutator_library =
+ (u8 *)get_afl_env(afl_environment_variables[i]);
} else if (!strncmp(env, "AFL_PYTHON_MODULE",
afl_environment_variable_len)) {
- afl->afl_env.afl_python_module = (u8 *)get_afl_env(env);
+ afl->afl_env.afl_python_module =
+ (u8 *)get_afl_env(afl_environment_variables[i]);
} else if (!strncmp(env, "AFL_PATH", afl_environment_variable_len)) {
- afl->afl_env.afl_path = (u8 *)get_afl_env(env);
+ afl->afl_env.afl_path =
+ (u8 *)get_afl_env(afl_environment_variables[i]);
} else if (!strncmp(env, "AFL_PRELOAD",
afl_environment_variable_len)) {
- afl->afl_env.afl_preload = (u8 *)get_afl_env(env);
+ afl->afl_env.afl_preload =
+ (u8 *)get_afl_env(afl_environment_variables[i]);
}

fix reading env vars in afl-fuzz