From 6aaf3a88f4bdc0f8fe34779c24b7716fe641561e Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 16 May 2018 13:59:55 +0200 Subject: [PATCH] lib: Fix array size in audit_logging MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit ../lib/audit_logging/audit_logging.c: In function ‘json_add_timestamp’: ../lib/audit_logging/audit_logging.c:603:12: error: ‘%s’ directive output may be truncated writing up to 9 bytes into a region of size between 0 and 43 [-Werror=format-truncation=] "%s.%06ld%s", ^~ ../lib/audit_logging/audit_logging.c:606:3: tz); ~~ ../lib/audit_logging/audit_logging.c:600:2: note: ‘snprintf’ output between 8 and 70 bytes into a destination of size 50 snprintf( ^~~~~~~~~ timestamp, ~~~~~~~~~~ sizeof(timestamp), ~~~~~~~~~~~~~~~~~~ "%s.%06ld%s", ~~~~~~~~~~~~~ buffer, ~~~~~~~ tv.tv_usec, ~~~~~~~~~~~ tz); ~~~ BUG: https://bugzilla.samba.org/show_bug.cgi?id=13437 Signed-off-by: Andreas Schneider Reviewed-by: Guenther Deschner (cherry picked from commit 8b7c8eb3907e2123acee67949e88c26072afc81a) --- auth/auth_log.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/auth/auth_log.c b/auth/auth_log.c index d4c6c445bed..72d8f818396 100644 --- a/auth/auth_log.c +++ b/auth/auth_log.c @@ -350,7 +350,7 @@ static void add_version(struct json_context *context, int major, int minor) static void add_timestamp(struct json_context *context) { char buffer[40]; /* formatted time less usec and timezone */ - char timestamp[50]; /* the formatted ISO 8601 time stamp */ + char timestamp[65]; /* the formatted ISO 8601 time stamp */ char tz[10]; /* formatted time zone */ struct tm* tm_info; /* current local time */ struct timeval tv; /* current system time */ -- 2.47.2