mirror of
https://gitlab.com/shorewall/code.git
synced 2024-12-18 04:11:22 +01:00
Disallow ?FORMAT when $max_format == 1
Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
575020c851
commit
3f28af80d2
@ -2006,7 +2006,14 @@ sub do_open_file( $ ) {
|
||||
$currentfilename = $fname;
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# Arguments are:
|
||||
#
|
||||
# - file name
|
||||
# - Maximum value allowed in ?FORMAT directives
|
||||
# - ?COMMENT allowed in this file
|
||||
# - Ignore ?COMMENT in ths file
|
||||
#
|
||||
sub open_file( $;$$$ ) {
|
||||
my ( $fname, $mf, $ca, $nc ) = @_;
|
||||
|
||||
@ -2275,6 +2282,7 @@ sub process_compiler_directive( $$$$ ) {
|
||||
|
||||
FORMAT => sub() {
|
||||
unless ( $omitting ) {
|
||||
directive_error( "?FORMAT is not allowed in this file", $filename, $linenumber ) unless $max_format > 1;
|
||||
directive_error( "Missing format", $filename, $linenumber ) unless supplied $expression;
|
||||
directive_error( "Invalid format ($expression)", $filename, $linenumber ) unless $expression =~ /^\d+$/;
|
||||
directive_error( "Format must be between 1 and $max_format", $filename, $linenumber ) unless $expression && $expression <= $max_format;
|
||||
|
Loading…
Reference in New Issue
Block a user