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
This commit is contained in:
parent
5b5efe4af0
commit
1afb4f2886
@ -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, "=");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user