From f64993fe4083b9213f47e9652fa8904373be9999 Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Mon, 20 Sep 2010 07:05:23 -0700 Subject: [PATCH] Tighen up parsing of bracketed lists --- Shorewall/Perl/Shorewall/Chains.pm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Shorewall/Perl/Shorewall/Chains.pm b/Shorewall/Perl/Shorewall/Chains.pm index 2b0238e16..5e7369ad3 100644 --- a/Shorewall/Perl/Shorewall/Chains.pm +++ b/Shorewall/Perl/Shorewall/Chains.pm @@ -2896,12 +2896,16 @@ sub mysplit( $ ) { my $element = shift @input; if ( $element =~ /\[/ ) { - while ( $element =~ tr/[/[/ != $element =~ tr/]/]/ ) { + while ( $element =~ tr/[/[/ > $element =~ tr/]/]/ ) { last unless @input; $element .= ( ',' . shift @input ); } - - fatal_error "Invalid Host List ($_[0])" unless $element =~ tr/[/[/ == $element =~ tr/]/]/; + + if ( $element =~ tr/[/[/ > $element =~ tr/]/]/ ) { + fatal_error "Missing ']' ($element)"; + } else { + fatal_error "Mismatched [...] ($element)" unless $element =~ tr/[/[/ == $element =~ tr/]/]/; + } } push @result, $element;