diff --git a/inc/farm.php b/inc/farm.php index a998eaab654268d8a8e962abcd1044094a1f84fc..af10357073a7e40851c20ff181183ff635d76053 100644 --- a/inc/farm.php +++ b/inc/farm.php @@ -46,8 +46,8 @@ function farm_confpath($farm) { if(isset($_REQUEST['animal']) || ('cli' == php_sapi_name() && isset($_SERVER['animal']))) { $mode = isset($_REQUEST['animal']) ? 'htaccess' : 'cli'; $animal = $mode == 'htaccess' ? $_REQUEST['animal'] : $_SERVER['animal']; - // check that $animal is a string and specifies a subdirectory of $farm - if (!is_string($animal) || strpos(fullpath($farm.'/'.$animal), fullpath($farm).'/') !== 0) + // check that $animal is a string and just a directory name and not a path + if (!is_string($animal) || strpbrk($animal, '\\/') !== false) nice_die('Sorry! Invalid animal name!'); if(!is_dir($farm.'/'.$animal)) nice_die("Sorry! This Wiki doesn't exist!");