]> git.hungrycats.org Git - linux/commitdiff
netfilter: x_tables: assert minimum target size
authorFlorian Westphal <fw@strlen.de>
Fri, 1 Apr 2016 12:17:25 +0000 (14:17 +0200)
committerSasha Levin <sasha.levin@oracle.com>
Tue, 12 Jul 2016 12:48:31 +0000 (08:48 -0400)
[ Upstream commit a08e4e190b866579896c09af59b3bdca821da2cd ]

The target size includes the size of the xt_entry_target struct.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
net/netfilter/x_tables.c

index d846b52a6fc0bfa31dee68b2e5736c7f6eba8faa..f432ee7e4d6dafbb6b3ae884af3d19d867a85aa8 100644 (file)
@@ -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;