From 7a82ff8bbaba68cae31b021e5608f74892a7cc58 Mon Sep 17 00:00:00 2001 From: teastep Date: Wed, 6 Feb 2008 17:45:03 +0000 Subject: [PATCH] Catch unprintable junk in config files git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@8150 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb --- Shorewall-perl/Shorewall/Config.pm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Shorewall-perl/Shorewall/Config.pm b/Shorewall-perl/Shorewall/Config.pm index bd2c92b8c..d9f35737d 100644 --- a/Shorewall-perl/Shorewall/Config.pm +++ b/Shorewall-perl/Shorewall/Config.pm @@ -1187,7 +1187,11 @@ sub read_a_line() { # $currentline = '', $currentlinenumber = 0, next if $currentline =~ /^\s*$/; # - # Line not blank -- Handle any first-entry message/capabilities check + # 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 # if ( $first_entry ) { reftype( $first_entry ) ? $first_entry->() : progress_message2( $first_entry ); @@ -1254,6 +1258,7 @@ sub read_a_line1() { chomp $currentline; next if $currentline =~ /^\s*$/; $currentline =~ s/#.*$//; # Remove Trailing Comments + fatal_error "Non-ASCII gunk in file" if $currentline =~ /[^\s[:print:]]/; $currentlinenumber = $.; return 1; }