From 61d6c3834de32c0ff5808c93da94b2b30b4791c8 Mon Sep 17 00:00:00 2001 From: Florian Westphal Date: Mon, 12 Nov 2018 14:40:41 +0100 Subject: xtables: add 'printf' attribute to xlate_add This allows gcc to check format string vs. passed arguments. Fix the fallout from this as well, typical warning produced is: libebt_mark_m.c:112:28: warning: format '%x' expects argument of type 'unsigned int', but argument 3 has type 'long unsigned int' [-Wformat=] xt_xlate_add(xl, "and 0x%x %s0 ", info->mask, ... ~^ ~~~~~~~~~~ so add the required casts or fixup format strings as needed. libxt_conntrack also passed an unneeded argument (port), so remove that. Signed-off-by: Florian Westphal --- include/xtables.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/xtables.h') diff --git a/include/xtables.h b/include/xtables.h index 2bc190cd..4aa084a1 100644 --- a/include/xtables.h +++ b/include/xtables.h @@ -627,7 +627,7 @@ extern const char *xtables_lmap_id2name(const struct xtables_lmap *, int); /* xlate infrastructure */ struct xt_xlate *xt_xlate_alloc(int size); void xt_xlate_free(struct xt_xlate *xl); -void xt_xlate_add(struct xt_xlate *xl, const char *fmt, ...); +void xt_xlate_add(struct xt_xlate *xl, const char *fmt, ...) __attribute__((format(printf,2,3))); void xt_xlate_add_comment(struct xt_xlate *xl, const char *comment); const char *xt_xlate_get_comment(struct xt_xlate *xl); const char *xt_xlate_get(struct xt_xlate *xl); -- cgit v1.2.3