[PATCH 08/19] netfilter: x_tables: assert minimum target size

Luis Henriques luis.henriques at canonical.com
Thu Jun 23 18:32:21 UTC 2016


From: Florian Westphal <fw at strlen.de>

The target size includes the size of the xt_entry_target struct.

Signed-off-by: Florian Westphal <fw at strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo at netfilter.org>
(cherry picked from commit a08e4e190b866579896c09af59b3bdca821da2cd)
BugLink: https://bugs.launchpad.net/bugs/1595350
Signed-off-by: Luis Henriques <luis.henriques at canonical.com>
---
 net/netfilter/x_tables.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c
index 796e3c19d805..a0a4c67e8708 100644
--- a/net/netfilter/x_tables.c
+++ b/net/netfilter/x_tables.c
@@ -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;
 




More information about the kernel-team mailing list