summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authoravg <avg@FreeBSD.org>2013-07-17 08:45:27 +0000
committeravg <avg@FreeBSD.org>2013-07-17 08:45:27 +0000
commit3dc57aad8c73909f1e359be76c153a8bd80abb32 (patch)
tree6bf1742229b16ddfdbee8a4044e28070987af525 /lib
parent245aaea467cf9f61dfd01b887de0297ba2ea60bc (diff)
downloadFreeBSD-src-3dc57aad8c73909f1e359be76c153a8bd80abb32.zip
FreeBSD-src-3dc57aad8c73909f1e359be76c153a8bd80abb32.tar.gz
[fix to r253380] __setenv: be explicit about placing '=' after name
This should a regression introduced in r253380 if malloc'ed memory happens to have '=' at the right place. Reported by: ache Pointyhat to: me (avg) MFC after: 1 day X-MFC with: r253380
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/stdlib/getenv.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/libc/stdlib/getenv.c b/lib/libc/stdlib/getenv.c
index 079b024..8451103 100644
--- a/lib/libc/stdlib/getenv.c
+++ b/lib/libc/stdlib/getenv.c
@@ -506,8 +506,7 @@ __setenv(const char *name, size_t nameLen, const char *value, int overwrite)
/* Save name of name/value pair. */
env = stpncpy(envVars[envNdx].name, name, nameLen);
- if ((envVars[envNdx].name)[nameLen] != '=')
- env = stpcpy(env, "=");
+ *env++ = '=';
}
else
env = envVars[envNdx].value;
OpenPOWER on IntegriCloud