Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unify environment variable handling #1564

Open
nbars opened this issue Oct 21, 2022 · 7 comments
Open

Unify environment variable handling #1564

nbars opened this issue Oct 21, 2022 · 7 comments
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@nbars
Copy link
Contributor

nbars commented Oct 21, 2022

Is your feature request related to a problem? Please describe.
Grepping through the code-base reveals many locations using getenv with hardcoded constants, even though there seems to be an interface (afl_env_vars_t) to unify the handling of environment variables. This makes it hard to keep track of which tool (afl-fuzz, afl-cmin, ...) implements which functionality.

Describe the solution you'd like
Unify environment variable handling by using afl_env_vars_t and related functions. This will require, besides other things, decoupling of read_afl_environment() from afl_state_t since afl_state_t is not used by all tools as far as I can tell.

Best,
Nils

@vanhauser-thc
Copy link
Member

a few vars are required before parsing the environment, but yes, in general that could be done and would be more clean.
but it is also effort. if you do not like it the way it is - please supply a PR.

@vanhauser-thc vanhauser-thc added help wanted Extra attention is needed good first issue Good for newcomers labels Oct 27, 2022
@Kundanagrawalofficial
Copy link

i think we can use this code
#include <stdlib.h>
#include "afl_env_vars.h"

afl_env_vars_t env_vars;

void init_env_vars() {
afl_init_env_vars(&env_vars);
}

void read_environment() {
afl_read_env_vars(env_vars, "ENV_VAR_NAME", &env_var_value);
/* use env_var_value */
}

void cleanup_env_vars() {
afl_cleanup_env_vars(&env_vars);
}

@nbars
Copy link
Contributor Author

nbars commented Feb 10, 2023

I really dont have time for that, but I guess pull requests are more than welcome :)

@sheftechdad
Copy link

hey,i really want to work on this issue

@KhushV25
Copy link

Hey can I work on this?

@vanhauser-thc
Copy link
Member

Hey can I work on this?

sure

@AlishRani
Copy link

/assign

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

6 participants