From 6656e1378f432ab8690e7d22128793a1ddc5166b Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Fri, 18 Nov 2005 17:59:56 +0000 Subject: Don't eat numeric arguments for other extensions --- extensions/libipt_ttl.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/extensions/libipt_ttl.c b/extensions/libipt_ttl.c index db5b002a..f9d52822 100644 --- a/extensions/libipt_ttl.c +++ b/extensions/libipt_ttl.c @@ -33,12 +33,12 @@ static int parse(int c, char **argv, int invert, unsigned int *flags, check_inverse(optarg, &invert, &optind, 0); - if (string_to_number(optarg, 0, 255, &value) == -1) - exit_error(PARAMETER_PROBLEM, - "ttl: Expected value between 0 and 255"); - switch (c) { case '2': + if (string_to_number(optarg, 0, 255, &value) == -1) + exit_error(PARAMETER_PROBLEM, + "ttl: Expected value between 0 and 255"); + if (invert) info->mode = IPT_TTL_NE; else @@ -48,6 +48,10 @@ static int parse(int c, char **argv, int invert, unsigned int *flags, info->ttl = value; break; case '3': + if (string_to_number(optarg, 0, 255, &value) == -1) + exit_error(PARAMETER_PROBLEM, + "ttl: Expected value between 0 and 255"); + if (invert) exit_error(PARAMETER_PROBLEM, "ttl: unexpected `!'"); @@ -56,6 +60,10 @@ static int parse(int c, char **argv, int invert, unsigned int *flags, info->ttl = value; break; case '4': + if (string_to_number(optarg, 0, 255, &value) == -1) + exit_error(PARAMETER_PROBLEM, + "ttl: Expected value between 0 and 255"); + if (invert) exit_error(PARAMETER_PROBLEM, "ttl: unexpected `!'"); -- cgit v1.2.3