Fix an off by one error when parsing PATH
This commit is contained in:
parent
09ff8eeecd
commit
3620e04769
@ -191,7 +191,7 @@ char **env_filter (void)
|
|||||||
strncmp (PATH_PREFIX, env_var, pplen) != 0)
|
strncmp (PATH_PREFIX, env_var, pplen) != 0)
|
||||||
{
|
{
|
||||||
got_path = true;
|
got_path = true;
|
||||||
env_len = strlen (env_name) + strlen (env_var) + pplen + 2;
|
env_len = strlen (env_name) + strlen (env_var) + pplen + 3;
|
||||||
e = p = xmalloc (sizeof (char) * env_len);
|
e = p = xmalloc (sizeof (char) * env_len);
|
||||||
p += snprintf (e, env_len, "%s=%s", env_name, PATH_PREFIX);
|
p += snprintf (e, env_len, "%s=%s", env_name, PATH_PREFIX);
|
||||||
|
|
||||||
@ -222,7 +222,7 @@ char **env_filter (void)
|
|||||||
/* We filtered the env but didn't get a PATH? Very odd.
|
/* We filtered the env but didn't get a PATH? Very odd.
|
||||||
However, we do need a path, so use a default. */
|
However, we do need a path, so use a default. */
|
||||||
if (! got_path) {
|
if (! got_path) {
|
||||||
env_len = strlen ("PATH=") + strlen (PATH_PREFIX) + 2;
|
env_len = strlen ("PATH=") + strlen (PATH_PREFIX) + 1;
|
||||||
e = xmalloc (sizeof (char) * env_len);
|
e = xmalloc (sizeof (char) * env_len);
|
||||||
snprintf (e, env_len, "PATH=%s", PATH_PREFIX);
|
snprintf (e, env_len, "PATH=%s", PATH_PREFIX);
|
||||||
rc_strlist_add (&env, e);
|
rc_strlist_add (&env, e);
|
||||||
|
Loading…
Reference in New Issue
Block a user