[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] [PATCH 3/4] liblogthread: use snprintf as it is considered safer



avoid security warning

Spotted by Coverity Scan

Signed-off-by: Fabio M. Di Nitto <fdinitto redhat com>
---
:100644 100644 384f042... 7230b2f... M	common/liblogthread/liblogthread.c
 common/liblogthread/liblogthread.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/common/liblogthread/liblogthread.c b/common/liblogthread/liblogthread.c
index 384f042..7230b2f 100644
--- a/common/liblogthread/liblogthread.c
+++ b/common/liblogthread/liblogthread.c
@@ -69,7 +69,7 @@ static void write_entry(int level, time_t *t, char *str)
 static void write_dropped(int level, time_t *t, int num)
 {
 	char str[ENTRY_STR_LEN];
-	sprintf(str, "dropped %d entries", num);
+	snprintf(str, sizeof(str) - 1, "dropped %d entries", num);
 	write_entry(level, t, str);
 }
 
-- 
1.7.4.4


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]