From a53e402912a7c4c4039b928d3b741fe8239ab2f7 Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Sun, 8 May 2011 02:40:34 -0500 Subject: [PATCH] logsys.c: Use snprintf() instead of sprintf(). Change a couple of string functions to use the the output length limiting counterpart. Signed-off-by: Russell Bryant --- exec/logsys.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exec/logsys.c b/exec/logsys.c index 579af998..90be53a5 100644 --- a/exec/logsys.c +++ b/exec/logsys.c @@ -505,7 +505,7 @@ static void log_printf_to_logs ( break; case 'l': - sprintf (line_no, "%d", file_line); + snprintf (line_no, sizeof (line_no), "%d", file_line); normal_p = line_no; syslog_p = line_no; break; @@ -1241,7 +1241,7 @@ void _logsys_log_vprintf ( subsysid = LOGSYS_DECODE_SUBSYSID(rec_ident); level = LOGSYS_DECODE_LEVEL(rec_ident); - len = vsprintf (logsys_print_buffer, format, ap); + len = vsnprintf (logsys_print_buffer, sizeof (logsys_print_buffer), format, ap); if (logsys_print_buffer[len - 1] == '\n') { logsys_print_buffer[len - 1] = '\0'; len -= 1;