From: Florian Westphal Date: Fri, 1 Apr 2016 12:17:25 +0000 (+0200) Subject: netfilter: x_tables: assert minimum target size X-Git-Tag: firefly_0821_release~176^2~4^2~40^2~12 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=ed30e07de077354993122c5d88e535cbe0a03754;p=firefly-linux-kernel-4.4.55.git netfilter: x_tables: assert minimum target size commit a08e4e190b866579896c09af59b3bdca821da2cd upstream. The target size includes the size of the xt_entry_target struct. Signed-off-by: Florian Westphal Signed-off-by: Pablo Neira Ayuso Signed-off-by: Greg Kroah-Hartman --- diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c index 24a9dfb51df2..e3e2dd4c55bf 100644 --- a/net/netfilter/x_tables.c +++ b/net/netfilter/x_tables.c @@ -567,6 +567,9 @@ int xt_check_entry_offsets(const void *base, return -EINVAL; t = (void *)(e + target_offset); + if (t->u.target_size < sizeof(*t)) + return -EINVAL; + if (target_offset + t->u.target_size > next_offset) return -EINVAL;