Make gunk patch a bit safer (allow non-ASCII characters in COMMENT lines)

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@8152 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2008-02-06 18:01:24 +00:00
parent 7a82ff8bba
commit 736f4f17bb

View File

@ -873,6 +873,7 @@ sub split_line( $$$ ) {
my ( $mincolumns, $maxcolumns, $description ) = @_;
fatal_error "Shorewall Configuration file entries may not contain single quotes, double quotes, single back quotes or backslashes" if $currentline =~ /["'`\\]/;
fatal_error "Non-ASCII gunk in file" if $currentline =~ /[^\s[:print:]]/;
my @line = split( ' ', $currentline );
@ -897,6 +898,7 @@ sub split_line1( $$$ ) {
return @line if $line[0] eq 'COMMENT';
fatal_error "Shorewall Configuration file entries may not contain single quotes" if $currentline =~ /'/;
fatal_error "Non-ASCII gunk in file" if $currentline =~ /[^\s[:print:]]/;
fatal_error "Invalid $description entry (too few columns)" if @line < $mincolumns;
fatal_error "Invalid $description entry (too many columns)" if @line > $maxcolumns;
@ -1187,11 +1189,7 @@ sub read_a_line() {
#
$currentline = '', $currentlinenumber = 0, next if $currentline =~ /^\s*$/;
#
# Line not blank -- Check for junk on the line
#
fatal_error "Non-ASCII gunk in file" if $currentline =~ /[^\s[:print:]]/;
#
# Handle any first-entry message/capabilities check
# Line not blank -- Handle any first-entry message/capabilities check
#
if ( $first_entry ) {
reftype( $first_entry ) ? $first_entry->() : progress_message2( $first_entry );