[iptables PATCH 1/5] libxtables: Fix potential array overrun in xtables_option_parse()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxx>
---
 libxtables/xtoptions.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libxtables/xtoptions.c b/libxtables/xtoptions.c
index ba3128bdbeb6b..326febd50dc90 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. */
-- 
2.18.0




[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux