From: Elise Lennion Date: Thu, 2 Feb 2017 12:25:53 +0000 (-0200) Subject: main: Validate the number of numeric options X-Git-Tag: v0.8~249 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9b7b2b64caff9de47de36a050cae9f3fbf58e433;p=thirdparty%2Fnftables.git main: Validate the number of numeric options 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 Signed-off-by: Pablo Neira Ayuso --- diff --git a/src/main.c b/src/main.c index 6ba752b1..1cc8b39f 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++;