Re: [SMARTY] Bug in security?

From: Date: Sat, 28 Jun 2003 15:15:40 +0000
Subject: Re: [SMARTY] Bug in security?
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-9789@lists.php.net to get a copy of this message
----- Original Message ----- From: "John Wards" <j.wards@sportnetwork.net> > Within smarty.class there is a bit of code that looks like this (around > line: 1430) > > if (substr(realpath($resource_name),0, strlen(realpath($curr_dir))) == > realpath($curr_dir)) { > $_smarty_secure = true; > break; > } This fixes it if $resource_name is a path to a file, but it doesn't work if $resource_name is a directory. Would $resource_name ever be a directory for any reason? if (substr(realpath($resource_name),0, strlen(realpath($curr_dir))) == realpath($curr_dir)) { //Double Check $temp = basename($resource_name); $temp2 = str_replace("/".$temp,"",$resource_name); if(realpath($curr_dir) == $temp2){ $_smarty_secure = true; break; } } Can anyone think of a better solution? Cheers John

« previous php.smarty.general (#9789) next »