cvs: smarty /libs/core core.is_secure.php

"Messju Mohr" <[email protected]>
Newsgroups gmane.comp.php.cvs.smarty
Message-ID <cvsmessju1060416519@cvsserver>
messju		Sat Aug  9 04:08:39 2003 EDT

  Modified files:              
    /smarty/libs/core	core.is_secure.php 
  Log:
  tightenend path checking in smarty_core_is_secure()
  
  
Index: smarty/libs/core/core.is_secure.php
diff -u smarty/libs/core/core.is_secure.php:1.2 smarty/libs/core/core.is_secure.php:1.3
--- smarty/libs/core/core.is_secure.php:1.2	Sat Jun 21 23:13:25 2003
+++ smarty/libs/core/core.is_secure.php	Sat Aug  9 04:08:39 2003
@@ -23,10 +23,13 @@
 
     $_smarty_secure = false;
     if ($params['resource_type'] == 'file') {
+        $_rp = realpath($params['resource_name']);
         if (!empty($smarty->secure_dir)) {
             foreach ((array)$smarty->secure_dir as $curr_dir) {
                 if ( !empty($curr_dir) && is_readable ($curr_dir)) {
-                    if (substr(realpath($params['resource_name']),0, strlen(realpath($curr_dir))) == realpath($curr_dir)) {
+                    $_cd = realpath($curr_dir);
+                    if (strncmp($_rp, $_cd, strlen($_cd)) == 0
+                        && $_rp{strlen($_cd)} == DIRECTORY_SEPARATOR ) {
                         $_smarty_secure = true;
                         break;
                     }



-- 
Smarty CVS Mailing List (http://cvs.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.