netfilter: x_tables: check standard target size too 18/154918/1
authorFlorian Westphal <fw@strlen.de>
Fri, 1 Apr 2016 12:17:27 +0000 (14:17 +0200)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Wed, 11 Oct 2017 11:17:26 +0000 (20:17 +0900)
commit051b8ceab1d7640a0e310412abd4799edee65122
treecf94db47a8cf4ec229adaa3697f749c2cad29fdc
parentfecd39deec9717ec5e5e759ba5a4988f5ebc3dd7
netfilter: x_tables: check standard target size too

commit 7ed2abddd20cf8f6bd27f65bd218f26fa5bf7f44 upstream.

We have targets and standard targets -- the latter carries a verdict.

The ip/ip6tables validation functions will access t->verdict for the
standard targets to fetch the jump offset or verdict for chainloop
detection, but this happens before the targets get checked/validated.

Thus we also need to check for verdict presence here, else t->verdict
can point right after a blob.

Spotted with UBSAN while testing malformed blobs.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
[sw0312.kim: cherry-pick from linux-3.10.y to apply CVE]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I8e2a37fc8313fd819fee9181bbbdee32cd2b4b95
net/netfilter/x_tables.c