diff options
author | avg <avg@FreeBSD.org> | 2013-07-16 07:26:46 +0000 |
---|---|---|
committer | avg <avg@FreeBSD.org> | 2013-07-16 07:26:46 +0000 |
commit | 1afb4f28866d80f39b458ae5f3d36219e7b47c59 (patch) | |
tree | cff6b47ab4fa155b1720a708c0c25e19155877b3 /lib | |
parent | 5b5efe4af0114c6bcee292845f8a61ddbffa3e4b (diff) | |
download | FreeBSD-src-1afb4f28866d80f39b458ae5f3d36219e7b47c59.zip FreeBSD-src-1afb4f28866d80f39b458ae5f3d36219e7b47c59.tar.gz |
libc: name passed into __setenv is not necessarily NUL-terminated
That's particularly true when __setenv is called from __merge_environ.
MFC after: 4 days
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/stdlib/getenv.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/libc/stdlib/getenv.c b/lib/libc/stdlib/getenv.c index 47963d5..079b024 100644 --- a/lib/libc/stdlib/getenv.c +++ b/lib/libc/stdlib/getenv.c @@ -505,7 +505,7 @@ __setenv(const char *name, size_t nameLen, const char *value, int overwrite) envVars[envNdx].valueSize = valueLen; /* Save name of name/value pair. */ - env = stpcpy(envVars[envNdx].name, name); + env = stpncpy(envVars[envNdx].name, name, nameLen); if ((envVars[envNdx].name)[nameLen] != '=') env = stpcpy(env, "="); } |