[issue1341] [PATCH]: printenv(1): don't allow '=' in name

Stathis Kamperis (via DragonFly issue tracker) sinknull at leaf.dragonflybsd.org
Sat Jul 25 13:23:19 PDT 2009


Stathis Kamperis <ekamperi at gmail.com> added the comment:

I am going to push this tomorrow or the day after, unless someone objects.

Just for the record, I have filed a PR in NetBSD bug database as well and they
fixed it differently:

. ..
        if (argc != 1)
                usage();
        if (strchr(*argv, '=') != NULL)
                errx(1, "Invalid environment variable %s", *argv);
        len = strlen(*argv);
        for (ep = environ; *ep; ep++)
. ..

POSIX says that env vars shouldn't contain an '=' sign and functions as
setenv(3) fail with EINVAL if the supplied name contains an equal sign.


Cheers,
Stathis

_____________________________________________________
DragonFly issue tracker <bugs at lists.dragonflybsd.org>
<http://bugs.dragonflybsd.org/issue1341>
_____________________________________________________





More information about the Bugs mailing list