OSDN Git Service

netfilter: x_tables: assert minimum target size
authorFlorian Westphal <fw@strlen.de>
Fri, 1 Apr 2016 12:17:25 +0000 (14:17 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Wed, 13 Apr 2016 22:30:36 +0000 (00:30 +0200)
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>
net/netfilter/x_tables.c

index 1f44bfa..ec1b718 100644 (file)
@@ -568,6 +568,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;