From a781480e959e4cad32f27915bdb5dab948aa1c6e Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Fri, 30 Sep 2011 22:20:37 -0600 Subject: [PATCH] Use length guarded sprintf functions Signed-off-by: Jens Axboe --- infolog.c | 4 ++-- server.c | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/infolog.c b/infolog.c index 8396522e..b7b4a5e9 100644 --- a/infolog.c +++ b/infolog.c @@ -12,7 +12,7 @@ int log_info(const char *format, ...) size_t len; va_start(args, format); - len = vsprintf(buffer, format, args); + len = vsnprintf(buffer, sizeof(buffer), format, args); va_end(args); if (is_backend) @@ -28,7 +28,7 @@ int log_err(const char *format, ...) size_t len; va_start(args, format); - len = vsprintf(buffer, format, args); + len = vsnprintf(buffer, sizeof(buffer), format, args); va_end(args); if (is_backend) diff --git a/server.c b/server.c index 4a78f383..a70dc14f 100644 --- a/server.c +++ b/server.c @@ -143,7 +143,6 @@ struct fio_net_cmd *fio_net_cmd_read(int sk) return NULL; } - return ret; } @@ -392,7 +391,7 @@ int fio_server_log(const char *format, ...) va_list args; va_start(args, format); - sprintf(buffer, format, args); + snprintf(buffer, sizeof(buffer), format, args); va_end(args); return fio_server_text_output(buffer, strlen(buffer)); -- 2.25.1