Skip to content
Snippets Groups Projects
Commit e0b6aade authored by Andreas Gohr's avatar Andreas Gohr
Browse files

do not accept empty or root $base in search. fixes #1452

You really never want to search the whole filesystem, so something must
have gone wrong. Better abort than go on.
parent 9c65e2a9
No related branches found
No related tags found
No related merge requests found
......@@ -28,6 +28,11 @@ function search(&$data,$base,$func,$opts,$dir='',$lvl=1,$sort='natural'){
$files = array();
$filepaths = array();
// safeguard against runaways #1452
if($base == '' || $base == '/') {
throw new RuntimeException('No valid $base passed to search() - possible misconfiguration or bug');
}
//read in directories and files
$dh = @opendir($base.'/'.$dir);
if(!$dh) return;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment