aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2020-04-09 13:17:56 +0200
committerDominik Maier <domenukk@gmail.com>2020-04-09 16:27:00 +0200
commit66f535ad616f740c477fc74b6c47c7e0027e3cae (patch)
treeb81142ee6bb72ef462de994503bf436773ed1ab7 /src
parentb8d84ababb22e2b2be3f38036e6f7e3aae5d050f (diff)
downloadafl++-66f535ad616f740c477fc74b6c47c7e0027e3cae.tar.gz
check for empty AFL env vars
Diffstat (limited to 'src')
-rw-r--r--src/afl-common.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/afl-common.c b/src/afl-common.c
index 73b3fa8a..7eee5265 100644
--- a/src/afl-common.c
+++ b/src/afl-common.c
@@ -353,7 +353,7 @@ void check_environment_vars(char **envp) {
if (be_quiet) return;
int index = 0, found = 0;
- char *env;
+ char *env, *val;
while ((env = envp[index++]) != NULL) {
if (strncmp(env, "ALF_", 4) == 0) {
@@ -367,10 +367,21 @@ void check_environment_vars(char **envp) {
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])] == '=')
+ env[strlen(afl_environment_variables[i])] == '=') {
+
match = 1;
- else
+ if ((val = getenv(afl_environment_variables[i])) && !*val)
+ WARNF(
+ "AFL environment variable %s defined but is empty, this can "
+ "lead to unexpected consequences",
+ afl_environment_variables[i]);
+
+ } else {
+
i++;
+
+ }
+
if (match == 0) {
WARNF("Mistyped AFL environment variable: %s", env);