From 772270f3b6a37a2dd9432541cce436e9b45bb6b9 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Mon, 20 Apr 2020 14:12:38 -0400 Subject: *: sprintf -> snprintf Replace sprintf with snprintf where straightforward to do so. - sprintf's into local scope buffers of known size are replaced with the equivalent snprintf call - snprintf's into local scope buffers of known size that use the buffer size expression now use sizeof(buffer) - sprintf(buf + strlen(buf), ...) replaced with snprintf() into temp buffer followed by strlcat Signed-off-by: Quentin Young --- lib/pid_output.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/pid_output.c') diff --git a/lib/pid_output.c b/lib/pid_output.c index f5f7b1d171..bd1d89a94c 100644 --- a/lib/pid_output.c +++ b/lib/pid_output.c @@ -65,7 +65,7 @@ pid_t pid_output(const char *path) exit(1); } - sprintf(buf, "%d\n", (int)pid); + snprintf(buf, sizeof(buf), "%d\n", (int)pid); pidsize = strlen(buf); if ((tmp = write(fd, buf, pidsize)) != (int)pidsize) flog_err_sys( -- cgit v1.2.3