summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2011-07-28 20:43:40 -0400
committerRich Felker <dalias@aerifal.cx>2011-07-28 20:43:40 -0400
commit649af9f73a84aa45742324d44384a873c8709915 (patch)
tree6c3c0853bf1515ba2d6750988bc374601ae94eb8
parente01ac67599dea1fd78a1bd1a0339a1da07dc9578 (diff)
downloadmusl-649af9f73a84aa45742324d44384a873c8709915.tar.gz
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.
-rw-r--r--src/env/setenv.c2
1 files changed, 1 insertions, 1 deletions
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;
}