From 144e82772ba597700adbbc9f6a212d45aa7ee60b Mon Sep 17 00:00:00 2001 From: "/C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=kaber/emailAddress=kaber@netfilter.org" 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 db5b002..f9d5282 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