mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-14 02:58:08 +00:00
Correctly handle env var.
This commit is contained in:
@ -359,7 +359,7 @@ typedef struct afl_env_vars {
|
|||||||
|
|
||||||
u8 *afl_tmpdir, *afl_custom_mutator_library, *afl_python_module, *afl_path,
|
u8 *afl_tmpdir, *afl_custom_mutator_library, *afl_python_module, *afl_path,
|
||||||
*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_max_det_extras, *afl_statsd_host, *afl_statsd_port;
|
||||||
|
|
||||||
} afl_env_vars_t;
|
} afl_env_vars_t;
|
||||||
|
|
||||||
|
@ -363,6 +363,19 @@ void read_afl_environment(afl_state_t *afl, char **envp) {
|
|||||||
afl->afl_env.afl_forksrv_init_tmout =
|
afl->afl_env.afl_forksrv_init_tmout =
|
||||||
(u8 *)get_afl_env(afl_environment_variables[i]);
|
(u8 *)get_afl_env(afl_environment_variables[i]);
|
||||||
|
|
||||||
|
} else if (!strncmp(env, "AFL_STATSD_HOST",
|
||||||
|
|
||||||
|
afl_environment_variable_len)) {
|
||||||
|
|
||||||
|
afl->afl_env.afl_statsd_host =
|
||||||
|
(u8 *)get_afl_env(afl_environment_variables[i]);
|
||||||
|
} else if (!strncmp(env, "AFL_STATSD_PORT",
|
||||||
|
|
||||||
|
afl_environment_variable_len)) {
|
||||||
|
|
||||||
|
afl->afl_env.afl_statsd_port =
|
||||||
|
(u8 *)get_afl_env(afl_environment_variables[i]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -60,10 +60,8 @@ int statsd_send_metric(afl_state_t *afl) {
|
|||||||
u16 port = STATSD_DEFAULT_PORT;
|
u16 port = STATSD_DEFAULT_PORT;
|
||||||
char *host = STATSD_DEFAULT_HOST;
|
char *host = STATSD_DEFAULT_HOST;
|
||||||
|
|
||||||
char *port_env;
|
if (afl->afl_env.afl_statsd_port) { port = atoi(afl->afl_env.afl_statsd_port); }
|
||||||
char *host_env;
|
if (afl->afl_env.afl_statsd_host) { host = afl->afl_env.afl_statsd_host; }
|
||||||
if ((port_env = getenv("AFL_STATSD_PORT")) != NULL) { port = atoi(port_env); }
|
|
||||||
if ((host_env = getenv("AFL_STATSD_HOST")) != NULL) { host = host_env; }
|
|
||||||
|
|
||||||
/* statds_sock is a global variable. We set it once in the beginning and reuse
|
/* statds_sock is a global variable. We set it once in the beginning and reuse
|
||||||
the socket. If the sendto later fail, we reset it to 0 to be able to recreate
|
the socket. If the sendto later fail, we reset it to 0 to be able to recreate
|
||||||
|
Reference in New Issue
Block a user