summaryrefslogtreecommitdiff
path: root/os/utils.c
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2011-10-29 11:08:17 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2011-11-23 12:15:06 -0800
commit05d8a7f7a785eff3292f0f0537bb3902930f1b5c (patch)
tree43dc322a988c1fab65622c2aea31c2b818ce20c8 /os/utils.c
parentb967bf2af264726042e2f6ffb9ca7d234f34b56b (diff)
Convert a bunch of sprintf to snprintf calls
This batch is the straightforward set - others are more complex and need more analysis to determine right size to pass. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Diffstat (limited to 'os/utils.c')
-rw-r--r--os/utils.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/os/utils.c b/os/utils.c
index 1c75dfce4..c828f01d9 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -258,7 +258,7 @@ LockServer(void)
*/
tmppath = LOCK_DIR;
- sprintf(port, "%d", atoi(display));
+ snprintf(port, sizeof(port), "%d", atoi(display));
len = strlen(LOCK_PREFIX) > strlen(LOCK_TMP_PREFIX) ? strlen(LOCK_PREFIX) :
strlen(LOCK_TMP_PREFIX);
len += strlen(tmppath) + strlen(port) + strlen(LOCK_SUFFIX) + 1;
@@ -295,7 +295,7 @@ LockServer(void)
}
if (lfd < 0)
FatalError("Could not create lock file in %s\n", tmp);
- (void) sprintf(pid_str, "%10ld\n", (long)getpid());
+ snprintf(pid_str, sizeof(pid_str), "%10ld\n", (long)getpid());
(void) write(lfd, pid_str, 11);
(void) fchmod(lfd, 0444);
(void) close(lfd);