From: Jacob Bachmeyer Date: Sun, 16 Oct 2022 01:02:16 +0000 (-0500) Subject: Use symbolic constant for maximum directory depth X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=200be6b810f930520ecee933b3e5a9b1d3a9489e;p=gatekeeper.git Use symbolic constant for maximum directory depth --- diff --git a/gatekeeper.pl b/gatekeeper.pl index 16ccac9..837dfe0 100755 --- a/gatekeeper.pl +++ b/gatekeeper.pl @@ -468,6 +468,9 @@ use constant MAX_FILE_NAME_LEN => 100; use constant MAX_DIRECTIVE_SIZE => 50*1024; # 50 KiB use constant MAX_SIGNATURE_SIZE => 50*1024; # 50 KiB +# limit on the number of subdirectories allowed +use constant MAX_DIRECTORY_DEPTH => 4; + # # -- Configuration sanity check # @@ -1110,7 +1113,7 @@ sub parse_directory_line { # A couple of subdir levels are ok, but don't allow hundreds. my $slash_count = ($val =~ tr,/,/,); fatal("$slash_count slashes is too many, in $val",1,$directive_file_contents) - if ($slash_count > 3 and not $do_not_fail); + if ($slash_count > (MAX_DIRECTORY_DEPTH-1) and not $do_not_fail); # Only let them specify one directory directive. fatal("Only one directory directive is allowed per directive file. "