summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEric Blake <ebb9@byu.net>2009-10-28 06:21:24 -0600
committerEric Blake <ebb9@byu.net>2009-10-28 06:24:52 -0600
commit54491d275184428be6e28e3f22f04859b7288105 (patch)
tree55e9a5b42249bc370d9d72f940f0a24b8e233db9 /src
parent42d12b45d35fc74e512a3c26adf49734525e4c6a (diff)
downloadcoreutils-54491d275184428be6e28e3f22f04859b7288105.tar.xz
printenv: ignore bogus variable names
Exposed by env a=b=c printenv a=b. * src/printenv.c (main): Silently reject = in names. * tests/misc/printenv: Test for it. * NEWS: Document this.
Diffstat (limited to 'src')
-rw-r--r--src/printenv.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/printenv.c b/src/printenv.c
index b0f0154b2..acf09bdc7 100644
--- a/src/printenv.c
+++ b/src/printenv.c
@@ -125,6 +125,10 @@ main (int argc, char **argv)
{
bool matched = false;
+ /* 'printenv a=b' is silent, even if 'a=b=c' is in environ. */
+ if (strchr (argv[i], '='))
+ continue;
+
for (env = environ; *env; ++env)
{
ep = *env;