diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2014-11-08 15:45:00 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2014-11-08 15:59:28 -0800 |
commit | 5d5a7f80d905d58530c8473bc7ec0b0b3b165658 (patch) | |
tree | 83544dd1f82127ccbfc2d44e879bac19b1f1ed09 | |
parent | 9a17f21de44bcfe1493e9d10ae2354c2a3b496b1 (diff) |
Replace last strcpy call + manual append with snprintf call
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r-- | config.c | 8 |
1 files changed, 3 insertions, 5 deletions
@@ -158,17 +158,15 @@ GetConfig ( if (*managed) { - n = strlen (p); - *startCommand = (char *) malloc (n + 2); + n = strlen (p) + 2; + *startCommand = (char *) malloc (n); if (! *startCommand) { fprintf (stderr, "Memory allocation failed for service \"%s\"\n", serviceName); break; } - strcpy (*startCommand, p); - (*startCommand)[n] = '&'; - (*startCommand)[n + 1] = '\0'; + snprintf(*startCommand, n, "%s&", p); } else { |