]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
extensions: recent: Fix format string for unsigned values
authorPhil Sutter <phil@nwl.cc>
Thu, 20 Jun 2024 16:17:16 +0000 (18:17 +0200)
committerPhil Sutter <phil@nwl.cc>
Sat, 27 Jul 2024 17:32:57 +0000 (19:32 +0200)
Both fields 'seconds' and 'hit_count' are unsigned, use '%u'
accordingly. While being at it, also fix coding-style in those lines.

Basically a day-1 bug, have Fixes: point at a reasonably old commit.

Fixes: af1660fe0e88c ("Move libipt_recent to libxt_recent")
Signed-off-by: Phil Sutter <phil@nwl.cc>
extensions/libxt_recent.c

index 055ae3508034684a321b051a6866c13122118543..0221d4462408f7beb5bc679c91318f3f88513d2e 100644 (file)
@@ -193,10 +193,12 @@ static void recent_print(const void *ip, const struct xt_entry_match *match,
                printf(" UPDATE");
        if (info->check_set & XT_RECENT_REMOVE)
                printf(" REMOVE");
-       if(info->seconds) printf(" seconds: %d", info->seconds);
+       if (info->seconds)
+               printf(" seconds: %u", info->seconds);
        if (info->check_set & XT_RECENT_REAP)
                printf(" reap");
-       if(info->hit_count) printf(" hit_count: %d", info->hit_count);
+       if (info->hit_count)
+               printf(" hit_count: %u", info->hit_count);
        if (info->check_set & XT_RECENT_TTL)
                printf(" TTL-Match");
        printf(" name: %s", info->name);
@@ -233,10 +235,12 @@ static void recent_save(const void *ip, const struct xt_entry_match *match,
                printf(" --update");
        if (info->check_set & XT_RECENT_REMOVE)
                printf(" --remove");
-       if(info->seconds) printf(" --seconds %d", info->seconds);
+       if (info->seconds)
+               printf(" --seconds %u", info->seconds);
        if (info->check_set & XT_RECENT_REAP)
                printf(" --reap");
-       if(info->hit_count) printf(" --hitcount %d", info->hit_count);
+       if (info->hit_count)
+               printf(" --hitcount %u", info->hit_count);
        if (info->check_set & XT_RECENT_TTL)
                printf(" --rttl");
        printf(" --name %s",info->name);