mirror of
https://gitlab.com/shorewall/code.git
synced 2025-06-23 19:21:21 +02:00
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:
parent
d1bbc2e820
commit
a5a3b4c3e7
@ -1172,15 +1172,18 @@ sub split_list1( $$ ) {
|
|||||||
my $element = '';
|
my $element = '';
|
||||||
|
|
||||||
for ( @list1 ) {
|
for ( @list1 ) {
|
||||||
if ( /\(/ ) {
|
my $count;
|
||||||
fatal_error "Invalid $type list ($list)" if $element;
|
|
||||||
if ( /\)/ ) {
|
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 , $_;
|
push @list2 , $_;
|
||||||
} else {
|
} else {
|
||||||
$element = $_;
|
$element = $_;
|
||||||
}
|
}
|
||||||
} elsif ( /\)$/ ) {
|
} elsif ( ( $count = tr/)/)/ ) > 0 ) {
|
||||||
fatal_error "Invalid $type list ($list)" unless $element;
|
fatal_error "Invalid $type list ($list)" unless $element && $count == 1;
|
||||||
push @list2, join ',', $element, $_;
|
push @list2, join ',', $element, $_;
|
||||||
$element = '';
|
$element = '';
|
||||||
} elsif ( $element ) {
|
} elsif ( $element ) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user