diff options
author | Rich Felker <dalias@aerifal.cx> | 2011-07-28 20:43:40 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2011-07-28 20:43:40 -0400 |
commit | 649af9f73a84aa45742324d44384a873c8709915 (patch) | |
tree | 6c3c0853bf1515ba2d6750988bc374601ae94eb8 /src/env/setenv.c | |
parent | e01ac67599dea1fd78a1bd1a0339a1da07dc9578 (diff) | |
download | musl-649af9f73a84aa45742324d44384a873c8709915.tar.gz musl-649af9f73a84aa45742324d44384a873c8709915.tar.xz musl-649af9f73a84aa45742324d44384a873c8709915.zip |
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.
Diffstat (limited to 'src/env/setenv.c')
-rw-r--r-- | src/env/setenv.c | 2 |
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; } |