diff options
authorDaniel Gröber <>2020-06-24 15:30:00 +0200
committerPablo Neira Ayuso <>2020-07-01 12:54:50 +0200
commit7e28a82781379329a50c5340676bbf629d71dfd0 (patch)
parent6c7c716bec3b3302c2212c9273c33f9640de8206 (diff)
conntrack: Fix incorrect snprintf size calculation
The previous BUFFER_SIZE() call already updated the remaining 'len'. So there is no need to subtract 'size' again. While this just makes the buffer appear smaller than it is, which is mostly harmless, the subtraction might underflow as 'size > len' is not checked like BUFFER_SIZE() does. Signed-off-by: Daniel Gröber <> Signed-off-by: Pablo Neira Ayuso <>
1 files changed, 1 insertions, 1 deletions
diff --git a/src/conntrack/snprintf_default.c b/src/conntrack/snprintf_default.c
index 2f2f918..081bcb6 100644
--- a/src/conntrack/snprintf_default.c
+++ b/src/conntrack/snprintf_default.c
@@ -108,7 +108,7 @@ static int __snprintf_address_ipv6(char *buf,
if (!inet_ntop(AF_INET6, &dst, tmp, sizeof(tmp)))
return -1;
- ret = snprintf(buf+offset, len-size, "%s=%s ", dst_tag, tmp);
+ ret = snprintf(buf + offset, len, "%s=%s ", dst_tag, tmp);
BUFFER_SIZE(ret, size, len, offset);
return size;