From 3620e0476934bfc14c496790eb67880efad4ce02 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Sat, 9 Feb 2008 18:16:53 +0000 Subject: Fix an off by one error when parsing PATH --- src/rc/rc-misc.c | 4 ++-- 1 file 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); -- cgit v1.2.3