1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 05:50:42 +02:00

[ticket/security-169] Stop loop through referer dir in top directory

SECURITY-169
This commit is contained in:
Marc Alexander
2014-11-09 22:29:25 +01:00
parent 0e772afb9d
commit 9bb302b92c
2 changed files with 22 additions and 1 deletions

View File

@@ -278,10 +278,16 @@ class path_helper
$referer_dir = dirname($referer_dir);
}
while (strpos($absolute_board_url, $referer_dir) !== 0)
while (($dir_position = strpos($absolute_board_url, $referer_dir)) !== 0)
{
$fixed_root_path .= '../';
$referer_dir = dirname($referer_dir);
// Just return phpbb_root_path if we reach the top directory
if ($referer_dir === '.')
{
return $this->phpbb_root_path;
}
}
$fixed_root_path .= substr($absolute_board_url, strlen($referer_dir) + 1);