mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-18 05:16:30 +00:00
Fixed twig filesystemloader security issue + test (closes #1026)
This commit is contained in:
committed by
Fabien Potencier
parent
481abb8332
commit
3d19a2eed5
@@ -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'),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user