From 649af9f73a84aa45742324d44384a873c8709915 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Thu, 28 Jul 2011 20:43:40 -0400 Subject: [PATCH] fix for setenv bogus var argument handling thanks to mikachu per POSIX: The setenv() function shall fail if: [EINVAL] The name argument is a null pointer, points to an empty string, or points to a string containing an '=' character. --- src/env/setenv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/env/setenv.c b/src/env/setenv.c index 03e165c8..c2c25444 100644 --- a/src/env/setenv.c +++ b/src/env/setenv.c @@ -9,7 +9,7 @@ int setenv(const char *var, const char *value, int overwrite) char *s; int l1, l2; - if (strchr(var, '=')) { + if (!var || !*var || strchr(var, '=')) { errno = EINVAL; return -1; } -- 2.25.1