diff options
author | Roland McGrath <roland@gnu.org> | 2004-06-09 18:33:36 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 2004-06-09 18:33:36 +0000 |
commit | e17f8b6119eb64d126422eda8a18d577cbdc9976 (patch) | |
tree | 420d90c088e34223e18c9dc838264785555aab9e /sysdeps/generic | |
parent | 616340ca428df8879afb1fcb8771d4e4050ff1e2 (diff) | |
download | glibc-e17f8b6119eb64d126422eda8a18d577cbdc9976.zip glibc-e17f8b6119eb64d126422eda8a18d577cbdc9976.tar.gz glibc-e17f8b6119eb64d126422eda8a18d577cbdc9976.tar.bz2 |
* sysdeps/generic/setenv.c (setenv): Return -1/EINVAL if name is
NULL, "" or contains '=' character in it. Reported by
Michael T Kerrisk <mtk-lists@gmx.net>.
* stdlib/tst-environ.c: Include errno.h.
(main): Add tests for these arguments to setenv/unsetenv.
Diffstat (limited to 'sysdeps/generic')
-rw-r--r-- | sysdeps/generic/setenv.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sysdeps/generic/setenv.c b/sysdeps/generic/setenv.c index a197713..48aaecf 100644 --- a/sysdeps/generic/setenv.c +++ b/sysdeps/generic/setenv.c @@ -265,6 +265,12 @@ setenv (name, value, replace) const char *value; int replace; { + if (name == NULL || *name == '\0' || strchr (name, '=') != NULL) + { + __set_errno (EINVAL); + return -1; + } + return __add_to_environ (name, value, NULL, replace); } |