netfilter: x_tables: validate all offsets and sizes in a rule
authorFlorian Westphal <fw@strlen.de>
Fri, 1 Apr 2016 12:17:29 +0000 (14:17 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 24 Jun 2016 17:22:05 +0000 (10:22 -0700)
commit04704bca3eef35f8874221750e11fad72b0764a3
treed6b2cab33e782a2dc4dcc63b23bda0b12f23ee28
parent98e02ab689f15b088f8d0baade85280ab21867b5
netfilter: x_tables: validate all offsets and sizes in a rule

commit 13631bfc604161a9d69cd68991dff8603edd66f9 upstream.

Validate that all matches (if any) add up to the beginning of
the target and that each match covers at least the base structure size.

The compat path should be able to safely re-use the function
as the structures only differ in alignment; added a
BUILD_BUG_ON just in case we have an arch that adds padding as well.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/netfilter/x_tables.c