From 4d2afe84f1921753a982700a0d329880252df77e Mon Sep 17 00:00:00 2001 From: teastep Date: Wed, 21 Mar 2007 00:55:01 +0000 Subject: [PATCH] Fix port range validation git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@5604 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb --- New/Shorewall/Chains.pm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/New/Shorewall/Chains.pm b/New/Shorewall/Chains.pm index 96739b39e..d5e075d9b 100644 --- a/New/Shorewall/Chains.pm +++ b/New/Shorewall/Chains.pm @@ -645,10 +645,12 @@ sub do_proto( $$$ ) if ( $count > 1 ) { fatal_error "Port list requires Multiport support in your kernel/iptables: $ports" unless $capabilities{MULTIPORT}; - fatal_error "Port range in a list requires Extended Multiport Support in your kernel/iptables: $ports" unless $capabilities{XMULTIPORT}; for my $port ( @ports ) { - $count++ if $port =~ /:/; + if ( $port =~ /:/ ) { + fatal_error "Port range in a list requires Extended Multiport Support in your kernel/iptables: $ports" unless $capabilities{XMULTIPORT}; + $count++; + } } fatal_error "Too many entries in port list: $ports" if $count > 15; @@ -665,10 +667,12 @@ sub do_proto( $$$ ) if ( $count > 1 ) { fatal_error "Port list requires Multiport support in your kernel/iptables: $sports" unless $capabilities{MULTIPORT}; - fatal_error "Port range in a list requires Extended Multiport Support in your kernel/iptables: $sports" unless $capabilities{XMULTIPORT}; for my $port ( @ports ) { - $count++ if $port =~ /:/; + if ( $port =~ /:/ ) { + fatal_error "Port range in a list requires Extended Multiport Support in your kernel/iptables: $sports" unless $capabilities{XMULTIPORT}; + $count++; + } } fatal_error "Too many entries in port list: $sports" if $count > 15;