From 3dc57aad8c73909f1e359be76c153a8bd80abb32 Mon Sep 17 00:00:00 2001 From: avg Date: Wed, 17 Jul 2013 08:45:27 +0000 Subject: [PATCH] [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 --- lib/libc/stdlib/getenv.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/libc/stdlib/getenv.c b/lib/libc/stdlib/getenv.c index 079b024dcfab..845110388a20 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;