From: Jan Engelhardt <jengelh@medozas.de>
To: kaber@trash.net
Cc: netfilter-devel@vger.kernel.org
Subject: [PATCH 1/3] xtoptions: fill in fallback value for nvals
Date: Thu, 1 Sep 2011 11:15:48 +0200 [thread overview]
Message-ID: <1314868551-4281-2-git-send-email-jengelh@medozas.de> (raw)
In-Reply-To: <1314868551-4281-1-git-send-email-jengelh@medozas.de>
Parsing for libxt_conntrack rev 2 is done by using rev 2's option
structure, which specifies XTTYPE_PORT, and using rev 3's parser
skeleton, which uses cb->nvals. Reading cb->nvals when not using
XTTYPE_PORTRC (or any other multi-value type) is undefined behavior.
Make it defined. Since XTTYPE_NONE is the only type that can take
void, nvals logically ought to be 1.
References: http://marc.info/?l=netfilter-devel&m=131370592105298&w=2
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
---
iptables/xtoptions.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/iptables/xtoptions.c b/iptables/xtoptions.c
index 04344af..5f617a4 100644
--- a/iptables/xtoptions.c
+++ b/iptables/xtoptions.c
@@ -826,6 +826,12 @@ void xtables_option_parse(struct xt_option_call *cb)
xt_params->exit_err(PARAMETER_PROBLEM,
"%s: option \"--%s\" requires an argument.\n",
cb->ext_name, entry->name);
+ /*
+ * Fill in fallback value for "nvals", in case an extension (as it
+ * happened with libxt_conntrack.2) tries to read it, despite not using
+ * a *RC option type.
+ */
+ cb->nvals = 1;
if (entry->type <= ARRAY_SIZE(xtopt_subparse) &&
xtopt_subparse[entry->type] != NULL)
xtopt_subparse[entry->type](cb);
--
1.7.3.4
next prev parent reply other threads:[~2011-09-01 9:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-01 9:15 iptables fixes 20110901 Jan Engelhardt
2011-09-01 9:15 ` Jan Engelhardt [this message]
2011-09-01 9:15 ` [PATCH 2/3] libxt_conntrack: improve error message on parsing violation Jan Engelhardt
2011-09-01 9:15 ` [PATCH 3/3] xtoptions: simplify xtables_parse_interface Jan Engelhardt
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=1314868551-4281-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).