From: Phil Sutter Date: Mon, 10 Sep 2018 21:35:13 +0000 (+0200) Subject: libxtables: Fix potential array overrun in xtables_option_parse() X-Git-Tag: v1.8.1~48 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4144571f87c094471419ef59e8bb89ef33cd1365;p=thirdparty%2Fiptables.git libxtables: Fix potential array overrun in xtables_option_parse() 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 Signed-off-by: Florian Westphal --- diff --git a/libxtables/xtoptions.c b/libxtables/xtoptions.c index ba3128bd..326febd5 100644 --- a/libxtables/xtoptions.c +++ b/libxtables/xtoptions.c @@ -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. */