From 92b74b562551a34b210667b692689cf224521209 Mon Sep 17 00:00:00 2001 From: Florian Westphal Date: Thu, 13 Jul 2017 16:02:31 +0200 Subject: exhtdr: pacify compiler warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit gcc 7.1.1 complains: exthdr.c:41:31: warning: ā€˜%dā€™ directive output may be truncated writing between 1 and 8 bytes into a region of size 3 [-Wformat-truncation=] snprintf(buf, sizeof buf, "%d", offset); ^~ This warning is incorrect, as offset is limited by tcp option ranges, but gcc doesn't know this. Increase buffer to avoid the warning. Signed-off-by: Florian Westphal --- src/exthdr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/exthdr.c b/src/exthdr.c index a678115b..a412025c 100644 --- a/src/exthdr.c +++ b/src/exthdr.c @@ -30,7 +30,7 @@ static void exthdr_expr_print(const struct expr *expr, struct output_ctx *octx) * multiplicator */ unsigned int offset = expr->exthdr.offset / 64; - char buf[3] = {0}; + char buf[9] = {0}; if (expr->exthdr.flags & NFT_EXTHDR_F_PRESENT) { printf("tcp option %s", expr->exthdr.desc->name); -- cgit v1.2.3