[PATCH 10/21] netfilter: x_tables: assert minimum target size
Luis Henriques
luis.henriques at canonical.com
Thu Jun 23 18:34:42 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 25188f8ff0d0..a87701d5827c 100644
--- a/net/netfilter/x_tables.c
+++ b/net/netfilter/x_tables.c
@@ -571,6 +571,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