Commit 5fb5dd0bd6f7e00ad8be2e8f39bf33fb00ba619d

Kano 2013-07-06T21:04:32

logging - size check sprintf

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/logging.c b/logging.c
index 489fed2..d00600f 100644
--- a/logging.c
+++ b/logging.c
@@ -63,7 +63,7 @@ void _applog(int prio, const char *str)
 		const time_t tmp_time = tv.tv_sec;
 		tm = localtime(&tmp_time);
 
-		sprintf(datetime, " [%d-%02d-%02d %02d:%02d:%02d] ",
+		snprintf(datetime, sizeof(datetime), " [%d-%02d-%02d %02d:%02d:%02d] ",
 			tm->tm_year + 1900,
 			tm->tm_mon + 1,
 			tm->tm_mday,