[PATCH] iptables: fix segfault target option parsing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



With v1.4.10-58-g94e247b, target option parsing started to happen in the
wrong case.

Signed-off-by: Jan Engelhardt <jengelh@xxxxxxxxxx>
---
 ip6tables.c |    6 +++---
 iptables.c  |    6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/ip6tables.c b/ip6tables.c
index 5561a7d..9f0b892 100644
--- a/ip6tables.c
+++ b/ip6tables.c
@@ -1245,9 +1245,9 @@ static void command_default(struct iptables_command_state *cs)
 	struct xtables_rule_match *matchp;
 	struct xtables_match *m;
 
-	if (cs->target == NULL || cs->target->parse == NULL ||
-	    cs->c < cs->target->option_offset ||
-	    cs->c >= cs->target->option_offset + XT_OPTION_OFFSET_SCALE) {
+	if (cs->target != NULL && cs->target->parse != NULL &&
+	    cs->c >= cs->target->option_offset &&
+	    cs->c < cs->target->option_offset + XT_OPTION_OFFSET_SCALE) {
 		cs->target->parse(cs->c - cs->target->option_offset, cs->argv,
 				  cs->invert, &cs->target->tflags, &cs->fw6,
 				  &cs->target->t);
diff --git a/iptables.c b/iptables.c
index 33fd882..a73df3e 100644
--- a/iptables.c
+++ b/iptables.c
@@ -1269,9 +1269,9 @@ static void command_default(struct iptables_command_state *cs)
 	struct xtables_rule_match *matchp;
 	struct xtables_match *m;
 
-	if (cs->target == NULL || cs->target->parse == NULL ||
-	    cs->c < cs->target->option_offset ||
-	    cs->c >= cs->target->option_offset + XT_OPTION_OFFSET_SCALE) {
+	if (cs->target != NULL && cs->target->parse != NULL &&
+	    cs->c >= cs->target->option_offset &&
+	    cs->c < cs->target->option_offset + XT_OPTION_OFFSET_SCALE) {
 		cs->target->parse(cs->c - cs->target->option_offset, cs->argv,
 				  cs->invert, &cs->target->tflags, &cs->fw,
 				  &cs->target->t);
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux