aboutsummaryrefslogtreecommitdiff
path: root/src/afl-common.c
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2020-02-16 18:16:10 +0100
committervan Hauser <vh@thc.org>2020-02-16 18:16:10 +0100
commit204059c61aca2ccdde64fbb59dbf6d86fb243bb3 (patch)
treec7ed9fb911835f570470bc0e0bf0193fe5434f9e /src/afl-common.c
parent4cccdb89c0112931e451bc0719880813d15d14dc (diff)
downloadafl++-204059c61aca2ccdde64fbb59dbf6d86fb243bb3.tar.gz
check for mistyped env vars
Diffstat (limited to 'src/afl-common.c')
-rw-r--r--src/afl-common.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/afl-common.c b/src/afl-common.c
index 958b9b7d..fee520c9 100644
--- a/src/afl-common.c
+++ b/src/afl-common.c
@@ -29,6 +29,7 @@
#include "debug.h"
#include "alloc-inl.h"
+#include "envs.h"
/* Detect @@ in args. */
#ifndef __glibc__
@@ -276,3 +277,39 @@ char** get_wine_argv(u8* own_loc, char** argv, int argc) {
}
+void check_environment_vars(char** envp) {
+
+ int index = 0, found = 0;
+ char* env;
+ while ((env = envp[index++]) != NULL) {
+
+ if (strncmp(env, "ALF_", 4) == 0) {
+
+ WARNF("Potentially mistyped AFL environment variable: %s", env);
+ found++;
+
+ } else if (strncmp(env, "AFL_", 4) == 0) {
+
+ int i = 0, match = 0;
+ while (match == 0 && afl_environment_variables[i] != NULL)
+ if (strncmp(env, afl_environment_variables[i],
+ strlen(afl_environment_variables[i])) == 0 &&
+ env[strlen(afl_environment_variables[i])] == '=')
+ match = 1;
+ else
+ i++;
+ if (match == 0) {
+
+ WARNF("Mistyped AFL environment variable: %s", env);
+ found++;
+
+ }
+
+ }
+
+ }
+
+ if (found) sleep(2);
+
+}
+