Ensure directory is at or under the chroot

This commit is contained in:
Jamie Cameron
2026-09-20 09:12:53 -07:00
parent dc558631ef
commit 6a53df97ef

View File

@@ -60,7 +60,7 @@ if (&supports_users()) {
# If a chroot is forced which is under the allowed root, there is no need for
# a restrictred root
if ($in{'chroot'} && $in{'chroot'} ne '/' && $rootdir && $rootdir ne '/' &&
$in{'chroot'} =~ /^\Q$rootdir\E/) {
($in{'chroot'} =~ /^\Q$rootdir\E\// || $in{'chroot'} eq $rootdir)) {
$rootdir = undef;
}