Make split_list1() a little more robust

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@9543 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2009-02-26 17:12:55 +00:00
parent d1bbc2e820
commit a5a3b4c3e7

View File

@ -1172,15 +1172,18 @@ sub split_list1( $$ ) {
my $element = '';
for ( @list1 ) {
if ( /\(/ ) {
fatal_error "Invalid $type list ($list)" if $element;
if ( /\)/ ) {
my $count;
if ( ( $count = tr/(/(/ ) > 0 ) {
fatal_error "Invalid $type list ($list)" if $element || $count > 1;
if ( ( $count = tr/)/)/ ) > 0 ) {
fatal_error "Invalid $type list ($list)" if $count > 1;
push @list2 , $_;
} else {
$element = $_;
}
} elsif ( /\)$/ ) {
fatal_error "Invalid $type list ($list)" unless $element;
} elsif ( ( $count = tr/)/)/ ) > 0 ) {
fatal_error "Invalid $type list ($list)" unless $element && $count == 1;
push @list2, join ',', $element, $_;
$element = '';
} elsif ( $element ) {