]> git.ipfire.org Git - thirdparty/ulogd2.git/commitdiff
output: JSON: increase time-stamp buffer size
authorJeremy Sowden <jeremy@azazel.net>
Tue, 30 Nov 2021 10:55:56 +0000 (10:55 +0000)
committerPablo Neira Ayuso <pablo@netfilter.org>
Mon, 3 Jan 2022 16:43:10 +0000 (17:43 +0100)
The output buffer for date-times is of sufficient size provided that we
don't get oversized integer values for any of the fields, which is a
reasonable assumption.  However, the compiler complains about possible
truncation, e.g.:

  ulogd_output_JSON.c:314:65: warning: `%06u` directive output may be truncated writing between 6 and 10 bytes into a region of size between 0 and 18
  ulogd_output_JSON.c:313:25: note: `snprintf` output between 27 and 88 bytes into a destination of size 38

Fix the warnings by increasing the buffer size.

Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
output/ulogd_output_JSON.c

index 8234e1b954cd5de596f6864083a5945301fc5b65..c8024488d42efa52c5c26c99346d1209534ca6c3 100644 (file)
@@ -269,7 +269,7 @@ static int json_interp_file(struct ulogd_pluginstance *upi, char *buf)
        return ULOGD_IRET_OK;
 }
 
-#define MAX_LOCAL_TIME_STRING 38
+#define MAX_LOCAL_TIME_STRING 80
 
 static int json_interp(struct ulogd_pluginstance *upi)
 {