]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
libxtables: Fix potential array overrun in xtables_option_parse()
authorPhil Sutter <phil@nwl.cc>
Mon, 10 Sep 2018 21:35:13 +0000 (23:35 +0200)
committerFlorian Westphal <fw@strlen.de>
Thu, 13 Sep 2018 08:47:42 +0000 (10:47 +0200)
If entry->type is to be used as array index, it needs to be at max one
less than that array's size.

Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Florian Westphal <fw@strlen.de>
libxtables/xtoptions.c

index ba3128bdbeb6b48cff284a06f01a5833423c2a84..326febd50dc906ff3dbfaf38f83578fb52b20634 100644 (file)
@@ -844,7 +844,7 @@ void xtables_option_parse(struct xt_option_call *cb)
         * a *RC option type.
         */
        cb->nvals = 1;
-       if (entry->type <= ARRAY_SIZE(xtopt_subparse) &&
+       if (entry->type < ARRAY_SIZE(xtopt_subparse) &&
            xtopt_subparse[entry->type] != NULL)
                xtopt_subparse[entry->type](cb);
        /* Exclusion with other flags tested later in finalize. */