From: Elise Lennion <elise.lennion@gmail.com>
To: pablo@netfilter.org
Cc: netfilter-devel@vger.kernel.org
Subject: [PATCH nft v2 1/2] main: Validate the number of numeric options
Date: Thu, 2 Feb 2017 10:25:53 -0200 [thread overview]
Message-ID: <20170202122553.GA17853@lennorien.com> (raw)
The number of numeric options influences the behavior and the user
should be warned if a invalid number is used.
Signed-off-by: Elise Lennion <elise.lennion@gmail.com>
---
v2: Was split from a bigger patch. Now an error is triggered when a
invalid number of numeric options is used, instead of allowing it and
using the closer valid number.
src/main.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/main.c b/src/main.c
index 6ba752b..48a813d 100644
--- a/src/main.c
+++ b/src/main.c
@@ -288,7 +288,12 @@ int main(int argc, char * const *argv)
include_paths[num_include_paths++] = optarg;
break;
case OPT_NUMERIC:
- numeric_output++;
+ if (++numeric_output > NUMERIC_ALL) {
+ fprintf(stderr, "Too many numeric options "
+ "used, max. %u\n",
+ NUMERIC_ALL);
+ exit(NFT_EXIT_FAILURE);
+ }
break;
case OPT_STATELESS:
stateless_output++;
--
2.7.4
next reply other threads:[~2017-02-02 12:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-02 12:25 Elise Lennion [this message]
2017-02-05 20:42 ` [PATCH nft v2 1/2] main: Validate the number of numeric options Pablo Neira Ayuso
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=20170202122553.GA17853@lennorien.com \
--to=elise.lennion@gmail.com \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.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).