summaryrefslogtreecommitdiffstats
path: root/include/nftables.h
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2023-08-29 14:53:37 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2023-08-29 20:03:42 +0200
commit0ba90cceaf8693a392196112c809302271259758 (patch)
treec0667affe1d7f21c2a0b31c646e577c8ccda7054 /include/nftables.h
parent83d1a6733691d8bbb9ca1b9c195591794074337d (diff)
include: drop "format" attribute from nft_gmp_print()
nft_gmp_print() passes the format string and arguments to gmp_vfprintf(). Note that the format string is then interpreted by gmp, which also understand special specifiers like "%Zx". Note that with clang we get various compiler warnings: datatype.c:299:26: error: invalid conversion specifier 'Z' [-Werror,-Wformat-invalid-specifier] nft_gmp_print(octx, "0x%Zx [invalid type]", expr->value); ~^ gcc doesn't warn, because to gcc 'Z' is a deprecated alias for 'z' and because the 3rd argument of the attribute((format())) is zero (so gcc doesn't validate the arguments). But Z specifier in gmp expects a "mpz_t" value and not a size_t. It's really not the same thing. The correct solution is not to mark the function to accept a printf format string. Fixes: 2535ba7006f2 ('src: get rid of printf') Signed-off-by: Thomas Haller <thaller@redhat.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'include/nftables.h')
-rw-r--r--include/nftables.h3
1 files changed, 1 insertions, 2 deletions
diff --git a/include/nftables.h b/include/nftables.h
index 219a1010..b9b2b01c 100644
--- a/include/nftables.h
+++ b/include/nftables.h
@@ -236,8 +236,7 @@ void realm_table_rt_exit(struct nft_ctx *ctx);
int nft_print(struct output_ctx *octx, const char *fmt, ...)
__attribute__((format(printf, 2, 3)));
-int nft_gmp_print(struct output_ctx *octx, const char *fmt, ...)
- __attribute__((format(printf, 2, 0)));
+int nft_gmp_print(struct output_ctx *octx, const char *fmt, ...);
int nft_optimize(struct nft_ctx *nft, struct list_head *cmds);