From: Florian Westphal Date: Fri, 1 Apr 2016 12:17:25 +0000 (+0200) Subject: netfilter: x_tables: assert minimum target size X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=6b9f8b74d347c956239e4538b1c3427cc5ea3ede;p=GitHub%2Fmt8127%2Fandroid_kernel_alcatel_ttab.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: Willy Tarreau --- diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c index 55b1e0ccb0e2..cc34bb38c814 100644 --- a/net/netfilter/x_tables.c +++ b/net/netfilter/x_tables.c @@ -587,6 +587,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;