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

[ticket/17141] Ensure correction is newer below 0

PHPBB3-17141
This commit is contained in:
Marc Alexander
2023-06-26 23:14:21 +02:00
parent 5ee2efd4c2
commit 8223a956df
2 changed files with 58 additions and 36 deletions

View File

@@ -236,7 +236,7 @@ class path_helper
// Prepend ../ to the phpbb_root_path as many times as / exists in path_info
$this->web_root_path = $this->filesystem->clean_path(
'./' . str_repeat('../', $corrections) . $this->phpbb_root_path
'./' . str_repeat('../', max(0, $corrections)) . $this->phpbb_root_path
);
return $this->web_root_path;
}
@@ -264,7 +264,7 @@ class path_helper
$relative_referer_path = substr($relative_referer_path, 0, $has_params);
}
$corrections = substr_count($relative_referer_path, '/');
return $this->phpbb_root_path . str_repeat('../', $corrections - 1);
return $this->phpbb_root_path . str_repeat('../', max(0, $corrections - 1));
}
// If not, it's a bit more complicated. We go to the parent directory