diff options
author | Patrick McHardy <kaber@trash.net> | 2005-11-18 17:59:56 +0000 |
---|---|---|
committer | Patrick McHardy <kaber@trash.net> | 2005-11-18 17:59:56 +0000 |
commit | 6656e1378f432ab8690e7d22128793a1ddc5166b (patch) | |
tree | 5cebfdf4bd299ee14e2769f100d36b1ef3db14d3 /extensions | |
parent | 5a4892b7566fd572a195b12b3a449d0c03125a54 (diff) |
Don't eat numeric arguments for other extensions
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/libipt_ttl.c | 16 |
1 files 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 `!'"); |