projects
/
oweals
/
musl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e01ac67
)
fix for setenv bogus var argument handling
author
Rich Felker
<dalias@aerifal.cx>
Fri, 29 Jul 2011 00:43:40 +0000
(20:43 -0400)
committer
Rich Felker
<dalias@aerifal.cx>
Fri, 29 Jul 2011 00:43:40 +0000
(20:43 -0400)
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
patch
|
blob
|
history
diff --git
a/src/env/setenv.c
b/src/env/setenv.c
index 03e165c8b332223f92d81d65088b1b288c5e4a42..c2c25444cbbd069c1eb99cd9f9ec8a57be0d18ce 100644
(file)
--- 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;
}