aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2007-04-06 08:37:15 +0000
committerRoy Marples <roy@marples.name>2007-04-06 08:37:15 +0000
commitab62a84790950cbc321b9251197b332461f480c6 (patch)
treeeee5c62c6846b77c21a5d1d212fefe6889cc51d8 /src
parent9cd5742bec56aa43267fabf4346b0f061dd3d151 (diff)
snprintf is better
Diffstat (limited to 'src')
-rw-r--r--src/librc-misc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/librc-misc.c b/src/librc-misc.c
index 75df0455..9cfd925f 100644
--- a/src/librc-misc.c
+++ b/src/librc-misc.c
@@ -512,7 +512,7 @@ char **rc_filter_env (void)
got_path = true;
env_len = strlen (env_name) + strlen (env_var) + pplen + 2;
e = p = rc_xmalloc (sizeof (char *) * env_len);
- p += sprintf (e, "%s=%s", env_name, PATH_PREFIX);
+ p += snprintf (e, env_len, "%s=%s", env_name, PATH_PREFIX);
/* Now go through the env var and only add bits not in our PREFIX */
sep = env_var;
@@ -525,7 +525,7 @@ char **rc_filter_env (void)
if (strcmp (tok, token) == 0)
break;
if (! tok)
- p += sprintf (p, ":%s", token);
+ p += snprintf (p, env_len - (p - e), ":%s", token);
free (np);
}
*p++ = 0;