about summary refs log tree commit diff
path: root/src/afl-fuzz-init.c
diff options
context:
space:
mode:
authorRishi Ranjan <43873720+rish9101@users.noreply.github.com>2020-03-15 22:59:23 +0530
committerGitHub <noreply@github.com>2020-03-15 18:29:23 +0100
commit126d1f1cd14c6bb1fb59159965045f02d98d1b43 (patch)
tree64a12fc2222b766087f0edfd63c30acf27c19cf4 /src/afl-fuzz-init.c
parent7685893cdbfd621b09b57a11c135347f692333cc (diff)
downloadafl++-126d1f1cd14c6bb1fb59159965045f02d98d1b43.tar.gz
Move afl-fuzz related env variables into afl_state_t (#252)
* Move afl-fuzz related env variables into afl_state_t

* Move the env variables assignment from fuzz_init and code Format

* Fix typo

* Remove redundant env variables from afl_env struct

* Rename function to read_afl_environment
Diffstat (limited to 'src/afl-fuzz-init.c')
-rw-r--r--src/afl-fuzz-init.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/afl-fuzz-init.c b/src/afl-fuzz-init.c
index c5ee2f80..88ff5217 100644
--- a/src/afl-fuzz-init.c
+++ b/src/afl-fuzz-init.c
@@ -43,7 +43,7 @@ void bind_to_free_cpu(afl_state_t *afl) {
 
   if (afl->cpu_core_count < 2) return;
 
-  if (getenv("AFL_NO_AFFINITY")) {
+  if (afl->afl_env.afl_no_affinity) {
 
     WARNF("Not binding to a CPU core (AFL_NO_AFFINITY set).");
     return;
@@ -275,7 +275,7 @@ cpuset_destroy(c);
 void setup_post(afl_state_t *afl) {
 
   void *dh;
-  u8 *  fn = get_afl_env("AFL_POST_LIBRARY");
+  u8 *  fn = afl->afl_env.afl_post_library;
   u32   tlen = 6;
 
   if (!fn) return;
@@ -448,7 +448,7 @@ void perform_dry_run(afl_state_t *afl) {
 
   struct queue_entry *q = afl->queue;
   u32                 cal_failures = 0;
-  u8 *                skip_crashes = get_afl_env("AFL_SKIP_CRASHES");
+  u8 *                skip_crashes = afl->afl_env.afl_skip_crashes;
 
   while (q) {
 
@@ -1538,7 +1538,7 @@ void check_cpu_governor(afl_state_t *afl) {
   u8    tmp[128];
   u64   min = 0, max = 0;
 
-  if (get_afl_env("AFL_SKIP_CPUFREQ")) return;
+  if (afl->afl_env.afl_skip_cpufreq) return;
 
   if (afl->cpu_aff > 0)
     snprintf(tmp, sizeof(tmp), "%s%d%s", "/sys/devices/system/cpu/cpu",
@@ -1619,7 +1619,7 @@ void check_cpu_governor(afl_state_t *afl) {
 #elif defined __APPLE__
   u64 min = 0, max = 0;
   size_t mlen = sizeof(min);
-  if (get_afl_env("AFL_SKIP_CPUFREQ")) return;
+  if (afl->afl_env.afl_skip_cpufreq) return;
 
   ACTF("Checking CPU scaling governor...");
 
@@ -1906,7 +1906,7 @@ void check_binary(afl_state_t *afl, u8 *fname) {
 
   }
 
-  if (get_afl_env("AFL_SKIP_BIN_CHECK") || afl->use_wine) return;
+  if (afl->afl_env.afl_skip_bin_check || afl->use_wine) return;
 
   /* Check for blatant user errors. */
 
@@ -2078,7 +2078,7 @@ void check_if_tty(afl_state_t *afl) {
 
   struct winsize ws;
 
-  if (get_afl_env("AFL_NO_UI")) {
+  if (afl->afl_env.afl_no_ui) {
 
     OKF("Disabling the UI because AFL_NO_UI is set.");
     afl->not_on_tty = 1;