All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH nft v2 1/2] main: Validate the number of numeric options
@ 2017-02-02 12:25 Elise Lennion
  2017-02-05 20:42 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 2+ messages in thread
From: Elise Lennion @ 2017-02-02 12:25 UTC (permalink / raw)
  To: pablo; +Cc: netfilter-devel

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH nft v2 1/2] main: Validate the number of numeric options
  2017-02-02 12:25 [PATCH nft v2 1/2] main: Validate the number of numeric options Elise Lennion
@ 2017-02-05 20:42 ` Pablo Neira Ayuso
  0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2017-02-05 20:42 UTC (permalink / raw)
  To: Elise Lennion; +Cc: netfilter-devel

On Thu, Feb 02, 2017 at 10:25:53AM -0200, Elise Lennion wrote:
> The number of numeric options influences the behavior and the user
> should be warned if a invalid number is used.

Applied, thanks Elise.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-02-05 20:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-02 12:25 [PATCH nft v2 1/2] main: Validate the number of numeric options Elise Lennion
2017-02-05 20:42 ` Pablo Neira Ayuso

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.