mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-17 20:28:08 +00:00
fixed tiny nitpicks
This commit is contained in:
@ -426,7 +426,7 @@ checks or alter some of the more exotic semantics of the tool:
|
|||||||
|
|
||||||
- If you are Jakub, you may need `AFL_I_DONT_CARE_ABOUT_MISSING_CRASHES`.
|
- If you are Jakub, you may need `AFL_I_DONT_CARE_ABOUT_MISSING_CRASHES`.
|
||||||
Others need not apply, unless they also want to disable the
|
Others need not apply, unless they also want to disable the
|
||||||
/proc/sys/kernel/core_pattern check.
|
`/proc/sys/kernel/core_pattern` check.
|
||||||
|
|
||||||
- Benchmarking only: `AFL_BENCH_JUST_ONE` causes the fuzzer to exit after
|
- Benchmarking only: `AFL_BENCH_JUST_ONE` causes the fuzzer to exit after
|
||||||
processing the first queue entry; and `AFL_BENCH_UNTIL_CRASH` causes it to
|
processing the first queue entry; and `AFL_BENCH_UNTIL_CRASH` causes it to
|
||||||
|
@ -390,7 +390,7 @@ typedef struct afl_env_vars {
|
|||||||
*afl_hang_tmout, *afl_forksrv_init_tmout, *afl_skip_crashes, *afl_preload,
|
*afl_hang_tmout, *afl_forksrv_init_tmout, *afl_skip_crashes, *afl_preload,
|
||||||
*afl_max_det_extras, *afl_statsd_host, *afl_statsd_port,
|
*afl_max_det_extras, *afl_statsd_host, *afl_statsd_port,
|
||||||
*afl_crash_exitcode, *afl_statsd_tags_flavor, *afl_testcache_size,
|
*afl_crash_exitcode, *afl_statsd_tags_flavor, *afl_testcache_size,
|
||||||
*afl_testcache_entries, *afl_kill_signal;
|
*afl_testcache_entries, *afl_kill_signal, *afl_target_env;
|
||||||
|
|
||||||
} afl_env_vars_t;
|
} afl_env_vars_t;
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ char * get_afl_env(char *env);
|
|||||||
|
|
||||||
/* Extract env vars from input string and set them using setenv()
|
/* Extract env vars from input string and set them using setenv()
|
||||||
For use with AFL_TARGET_ENV, ... */
|
For use with AFL_TARGET_ENV, ... */
|
||||||
u8 extract_and_set_env(u8 *env_str);
|
bool extract_and_set_env(u8 *env_str);
|
||||||
|
|
||||||
extern u8 be_quiet;
|
extern u8 be_quiet;
|
||||||
extern u8 *doc_path; /* path to documentation dir */
|
extern u8 *doc_path; /* path to documentation dir */
|
||||||
|
@ -618,19 +618,15 @@ char *get_afl_env(char *env) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 extract_and_set_env(u8 *env_str) {
|
bool extract_and_set_env(u8 *env_str) {
|
||||||
|
|
||||||
if (!env_str) { return 0; }
|
if (!env_str) { return false; }
|
||||||
|
|
||||||
|
bool ret = false; // return false by default
|
||||||
|
|
||||||
u8 *p = ck_strdup(env_str);
|
u8 *p = ck_strdup(env_str);
|
||||||
|
|
||||||
u8 *end = p + strlen((char *)p);
|
u8 *end = p + strlen((char *)p);
|
||||||
|
|
||||||
u8 ret_val = 0; // return false by default
|
|
||||||
|
|
||||||
u8 *rest = p;
|
u8 *rest = p;
|
||||||
u8 *key = p;
|
|
||||||
u8 *val = p;
|
|
||||||
|
|
||||||
u8 closing_sym = ' ';
|
u8 closing_sym = ' ';
|
||||||
u8 c;
|
u8 c;
|
||||||
@ -647,7 +643,7 @@ u8 extract_and_set_env(u8 *env_str) {
|
|||||||
|
|
||||||
if (rest + 1 >= end) break;
|
if (rest + 1 >= end) break;
|
||||||
|
|
||||||
key = rest;
|
u8 *key = rest;
|
||||||
// env variable names may not start with numbers or '='
|
// env variable names may not start with numbers or '='
|
||||||
if (*key == '=' || (*key >= '0' && *key <= '9')) { goto free_and_return; }
|
if (*key == '=' || (*key >= '0' && *key <= '9')) { goto free_and_return; }
|
||||||
|
|
||||||
@ -673,7 +669,7 @@ u8 extract_and_set_env(u8 *env_str) {
|
|||||||
rest += 1;
|
rest += 1;
|
||||||
if (rest >= end || *rest == ' ') { goto free_and_return; }
|
if (rest >= end || *rest == ' ') { goto free_and_return; }
|
||||||
|
|
||||||
val = rest;
|
u8 *val = rest;
|
||||||
if (*val == '\'' || *val == '"') {
|
if (*val == '\'' || *val == '"') {
|
||||||
|
|
||||||
closing_sym = *val;
|
closing_sym = *val;
|
||||||
@ -700,17 +696,17 @@ u8 extract_and_set_env(u8 *env_str) {
|
|||||||
rest += 1;
|
rest += 1;
|
||||||
if (rest < end && *rest != ' ') { goto free_and_return; }
|
if (rest < end && *rest != ' ') { goto free_and_return; }
|
||||||
|
|
||||||
num_pairs += 1;
|
num_pairs++;
|
||||||
|
|
||||||
setenv(key, val, 1);
|
setenv(key, val, 1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (num_pairs > 0) { ret_val = 1; }
|
if (num_pairs) { ret = true; }
|
||||||
|
|
||||||
free_and_return:
|
free_and_return:
|
||||||
ck_free(p);
|
ck_free(p);
|
||||||
return ret_val;
|
return ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -433,6 +433,13 @@ void read_afl_environment(afl_state_t *afl, char **envp) {
|
|||||||
afl->afl_env.afl_kill_signal =
|
afl->afl_env.afl_kill_signal =
|
||||||
(u8 *)get_afl_env(afl_environment_variables[i]);
|
(u8 *)get_afl_env(afl_environment_variables[i]);
|
||||||
|
|
||||||
|
} else if (!strncmp(env, "AFL_TARGET_ENV",
|
||||||
|
|
||||||
|
afl_environment_variable_len)) {
|
||||||
|
|
||||||
|
afl->afl_env.afl_target_env =
|
||||||
|
(u8 *)get_afl_env(afl_environment_variables[i]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -1304,8 +1304,8 @@ int main(int argc, char **argv_orig, char **envp) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 *extra_env = (u8 *)getenv("AFL_TARGET_ENV");
|
if (afl->afl_env.afl_target_env &&
|
||||||
if (extra_env && !extract_and_set_env(extra_env)) {
|
!extract_and_set_env(afl->afl_env.afl_target_env)) {
|
||||||
|
|
||||||
FATAL("Bad value of AFL_TARGET_ENV");
|
FATAL("Bad value of AFL_TARGET_ENV");
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user