From: Florian Westphal Date: Fri, 1 Apr 2016 12:17:25 +0000 (+0200) Subject: netfilter: x_tables: assert minimum target size X-Git-Tag: v4.1.12-92~70^2~14 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=7b84e96b573498839441b0abdeb445b644d85ae2;p=users%2Fjedix%2Flinux-maple.git netfilter: x_tables: assert minimum target size Orabug: 24690280 CVE: CVE-2016-3134 [ Upstream commit a08e4e190b866579896c09af59b3bdca821da2cd ] 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: Sasha Levin (cherry picked from commit aae91919c9d6d1aa6d6390826979e6d2c89a7ba4) Signed-off-by: Brian Maly --- diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c index 7540522a8d27..cdee456f48d1 100644 --- a/net/netfilter/x_tables.c +++ b/net/netfilter/x_tables.c @@ -570,6 +570,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;