]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
xtables: Fix for segfault when registering hashlimit extension
authorHeena Sirwani <heenasirwani@gmail.com>
Tue, 21 Aug 2018 11:55:56 +0000 (17:25 +0530)
committerFlorian Westphal <fw@strlen.de>
Tue, 21 Aug 2018 11:58:17 +0000 (13:58 +0200)
This patch fixes the crash when registering the hashlimit extension
with xtables during init_extensions(when built with static libs) .
The option validation function xtables_option_metavalidate has a
loop termination condition of the entry name being NULL. The loop
does not terminate when validating hashlimit_mt_opts_v2 which causes
a crash on derefencing an invalid entry.

Signed-off-by: Heena Sirwani <heenasirwani@gmail.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
extensions/libxt_hashlimit.c

index 70bc615b1f2de9a1c986fe2105fff71381fccda8..7d78d852db1fd56730d7ec5ebdacf007d6af6415 100644 (file)
@@ -205,6 +205,7 @@ static const struct xt_option_entry hashlimit_mt_opts_v2[] = {
        {.name = "hashlimit-mode", .id = O_MODE, .type = XTTYPE_STRING},
        {.name = "hashlimit-name", .id = O_NAME, .type = XTTYPE_STRING,
         .flags = XTOPT_MAND | XTOPT_PUT, XTOPT_POINTER(s, name), .min = 1},
+       XTOPT_TABLEEND,
 };
 #undef s