aboutsummaryrefslogtreecommitdiff
path: root/src/rc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/rc.c')
-rw-r--r--src/rc.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/rc.c b/src/rc.c
index 12851c50..9b7d0edb 100644
--- a/src/rc.c
+++ b/src/rc.c
@@ -1013,19 +1013,22 @@ int main (int argc, char **argv)
/* Unless we would use a different config file */
if (found)
{
+ int len;
if (! newlevel)
continue;
-
- tmp = rc_xmalloc (strlen (service) + strlen (runlevel) + 2);
- sprintf (tmp, "%s.%s", service, runlevel);
+
+ len = strlen (service) + strlen (runlevel) + 2;
+ tmp = rc_xmalloc (sizeof (char *) * len);
+ snprintf (tmp, len, "%s.%s", service, runlevel);
conf = rc_strcatpaths (RC_CONFDIR, tmp, (char *) NULL);
found = rc_exists (conf);
CHAR_FREE (conf);
CHAR_FREE (tmp);
if (! found)
{
- tmp = rc_xmalloc (strlen (service) + strlen (newlevel) + 2);
- sprintf (tmp, "%s.%s", service, newlevel);
+ len = strlen (service) + strlen (newlevel) + 2;
+ tmp = rc_xmalloc (sizeof (char *) * len);
+ snprintf (tmp, len, "%s.%s", service, newlevel);
conf = rc_strcatpaths (RC_CONFDIR, tmp, (char *) NULL);
found = rc_exists (conf);
CHAR_FREE (conf);