aboutsummaryrefslogtreecommitdiff
path: root/src/rc
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2008-02-09 18:16:53 +0000
committerRoy Marples <roy@marples.name>2008-02-09 18:16:53 +0000
commit3620e0476934bfc14c496790eb67880efad4ce02 (patch)
treea6a340a7c926b4ca46359da45c4144ddede6c921 /src/rc
parent09ff8eeecd3e4c3819f3c3783c9a56d398cd8ec3 (diff)
Fix an off by one error when parsing PATH
Diffstat (limited to 'src/rc')
-rw-r--r--src/rc/rc-misc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/rc/rc-misc.c b/src/rc/rc-misc.c
index 59a52615..e56f8006 100644
--- a/src/rc/rc-misc.c
+++ b/src/rc/rc-misc.c
@@ -191,7 +191,7 @@ char **env_filter (void)
strncmp (PATH_PREFIX, env_var, pplen) != 0)
{
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);
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.
However, we do need a path, so use a default. */
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);
snprintf (e, env_len, "PATH=%s", PATH_PREFIX);
rc_strlist_add (&env, e);