summaryrefslogtreecommitdiffstats
path: root/extensions/libip6t_tcp.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2002-03-14 11:35:58 +0000
committerHarald Welte <laforge@gnumonks.org>2002-03-14 11:35:58 +0000
commitb77f1dafb9f35752bb9685323bcacb32a0e6ddc5 (patch)
tree32821b41042796995881aabc74f6821e7603b288 /extensions/libip6t_tcp.c
parentdffa8ddb43ca2d5bfe7344daea2f6e80c5adaa58 (diff)
Fix 'iptables -p !' bug (segfault when `!' used without argument)
Diffstat (limited to 'extensions/libip6t_tcp.c')
-rw-r--r--extensions/libip6t_tcp.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/extensions/libip6t_tcp.c b/extensions/libip6t_tcp.c
index f03f072a..d158a8c2 100644
--- a/extensions/libip6t_tcp.c
+++ b/extensions/libip6t_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 |= IP6T_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 |= IP6T_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] == '!')
@@ -232,8 +229,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 |= IP6T_TCP_INV_OPTION;