From: Jan Engelhardt <jengelh@medozas.de>
To: kaber@trash.net
Cc: netfilter-devel@vger.kernel.org
Subject: [PATCH] iptables: fix segfault target option parsing
Date: Fri, 11 Feb 2011 02:07:26 +0100 [thread overview]
Message-ID: <1297386447-30546-2-git-send-email-jengelh@medozas.de> (raw)
In-Reply-To: <1297386447-30546-1-git-send-email-jengelh@medozas.de>
With v1.4.10-58-g94e247b, target option parsing started to happen in the
wrong case.
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
---
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
next prev parent reply other threads:[~2011-02-11 1:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-11 1:07 iptables: option fix Jan Engelhardt
2011-02-11 1:07 ` Jan Engelhardt [this message]
2011-02-11 16:57 ` Patrick McHardy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1297386447-30546-2-git-send-email-jengelh@medozas.de \
--to=jengelh@medozas.de \
--cc=kaber@trash.net \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).