Fixed twig filesystemloader security issue + test (closes #1026)

This commit is contained in:
Rick Prent
2013-03-08 14:16:10 +01:00
committed by Fabien Potencier
parent 481abb8332
commit 3d19a2eed5
2 changed files with 2 additions and 0 deletions
+1
View File
@@ -203,6 +203,7 @@ class Twig_Loader_Filesystem implements Twig_LoaderInterface, Twig_ExistsLoaderI
throw new Twig_Error_Loader('A template name cannot contain NUL bytes.');
}
$name = ltrim($name, '/');
$parts = explode('/', $name);
$level = 0;
foreach ($parts as $part) {
@@ -47,6 +47,7 @@ class Twig_Tests_Loader_FilesystemTest extends PHPUnit_Framework_TestCase
array('filters\\..\\..\\AutoloaderTest.php'),
array('filters\\\\..\\\\..\\\\AutoloaderTest.php'),
array('filters\\//../\\/\\..\\AutoloaderTest.php'),
array('/../AutoloaderTest.php'),
);
}