From: Rich Felker Date: Fri, 29 Jul 2011 00:43:40 +0000 (-0400) Subject: fix for setenv bogus var argument handling X-Git-Url: http://nsz.repo.hu/git/?p=musl;a=commitdiff_plain;h=649af9f73a84aa45742324d44384a873c8709915 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. --- 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; }