diff options
author | laforge <laforge> | 2002-03-14 11:35:58 +0000 |
---|---|---|
committer | laforge <laforge> | 2002-03-14 11:35:58 +0000 |
commit | 01608a86ae513b512ec966845e86a8490dc502f8 (patch) | |
tree | 32821b41042796995881aabc74f6821e7603b288 /extensions/libipt_tcp.c | |
parent | b57c177708274e319680a5ac425fabbcbee7edb1 (diff) |
Fix 'iptables -p !' bug (segfault when `!' used without argument)
Diffstat (limited to 'extensions/libipt_tcp.c')
-rw-r--r-- | extensions/libipt_tcp.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/extensions/libipt_tcp.c b/extensions/libipt_tcp.c index 7f17252..85f6d78 100644 --- a/extensions/libipt_tcp.c +++ b/extensions/libipt_tcp.c @@ -178,8 +178,7 @@ parse(int c, char **argv, int invert, unsigned int *flags, if (*flags & TCP_SRC_PORTS) exit_error(PARAMETER_PROBLEM, "Only one `--source-port' allowed"); - if (check_inverse(optarg, &invert)) - optind++; + check_inverse(optarg, &invert, &optind, 0); parse_tcp_ports(argv[optind-1], tcpinfo->spts); if (invert) tcpinfo->invflags |= IPT_TCP_INV_SRCPT; @@ -191,8 +190,7 @@ parse(int c, char **argv, int invert, unsigned int *flags, if (*flags & TCP_DST_PORTS) exit_error(PARAMETER_PROBLEM, "Only one `--destination-port' allowed"); - if (check_inverse(optarg, &invert)) - optind++; + check_inverse(optarg, &invert, &optind, 0); parse_tcp_ports(argv[optind-1], tcpinfo->dpts); if (invert) tcpinfo->invflags |= IPT_TCP_INV_DSTPT; @@ -215,8 +213,7 @@ parse(int c, char **argv, int invert, unsigned int *flags, exit_error(PARAMETER_PROBLEM, "Only one of `--syn' or `--tcp-flags' " " allowed"); - if (check_inverse(optarg, &invert)) - optind++; + check_inverse(optarg, &invert, &optind, 0); if (!argv[optind] || argv[optind][0] == '-' || argv[optind][0] == '!') @@ -234,8 +231,7 @@ parse(int c, char **argv, int invert, unsigned int *flags, if (*flags & TCP_OPTION) exit_error(PARAMETER_PROBLEM, "Only one `--tcp-option' allowed"); - if (check_inverse(optarg, &invert)) - optind++; + check_inverse(optarg, &invert, &optind, 0); parse_tcp_option(argv[optind-1], &tcpinfo->option); if (invert) tcpinfo->invflags |= IPT_TCP_INV_OPTION; |