diff --git a/chooser.cgi b/chooser.cgi index 7c90c78f4..c36bddef6 100755 --- a/chooser.cgi +++ b/chooser.cgi @@ -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; }