From 6a53df97efb18ff2275e768cd30c21565a8e867e Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Sun, 20 Sep 2026 09:12:53 -0700 Subject: [PATCH] Ensure directory is at or under the chroot --- chooser.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; }