From d487b7083ae25519a126af4cc0a68874c5161c0c Mon Sep 17 00:00:00 2001 From: Nicole Cordes <typo3@cordes.co> Date: Mon, 13 Feb 2017 14:22:39 +0100 Subject: [PATCH] [BUGFIX] Ignore invalid files in LocalDriver::getDirectoryItemList Due to some security changes in GeneralUtility::validPathStr some wrongly encoded files are now returned as invalid. This breaks e.g. the file list. This patch adds a try/catch block to ignore invalid files and return the valid ones. Resolves: #79776 Releases: master, 7.6, 6.2 Change-Id: Iaa3697b04c123bba61a426fdf39ee3959f68b705 Reviewed-on: https://review.typo3.org/51655 Tested-by: TYPO3com <no-reply@typo3.com> Reviewed-by: Tobias Liebig <tobias.liebig@typo3.org> Tested-by: Tobias Liebig <tobias.liebig@typo3.org> Reviewed-by: Georg Ringer <georg.ringer@gmail.com> Tested-by: Georg Ringer <georg.ringer@gmail.com> Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl> Reviewed-by: Sascha Egerer <sascha@sascha-egerer.de> Tested-by: Sascha Egerer <sascha@sascha-egerer.de> Reviewed-by: Joerg Boesche <typo3@joergboesche.de> Reviewed-by: Nicole Cordes <typo3@cordes.co> Tested-by: Nicole Cordes <typo3@cordes.co> --- .../Classes/Resource/Driver/LocalDriver.php | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/typo3/sysext/core/Classes/Resource/Driver/LocalDriver.php b/typo3/sysext/core/Classes/Resource/Driver/LocalDriver.php index cc41f4d21544..c969b91f1ad2 100644 --- a/typo3/sysext/core/Classes/Resource/Driver/LocalDriver.php +++ b/typo3/sysext/core/Classes/Resource/Driver/LocalDriver.php @@ -372,22 +372,25 @@ class LocalDriver extends AbstractHierarchicalFilesystemDriver // go on to the next iterator item now as we might skip this one early $iterator->next(); - if ( + try { + if ( !$this->applyFilterMethodsToDirectoryItem( $filterMethods, $iteratorItem['name'], $iteratorItem['identifier'], $this->getParentFolderIdentifierOfIdentifier($iteratorItem['identifier']) ) - ) { - continue; - } + ) { + continue; + } - $items[$iteratorItem['identifier']] = $iteratorItem['identifier']; - // Decrement item counter to make sure we only return $numberOfItems - // we cannot do this earlier in the method (unlike moving the iterator forward) because we only add the - // item here - --$c; + $items[$iteratorItem['identifier']] = $iteratorItem['identifier']; + // Decrement item counter to make sure we only return $numberOfItems + // we cannot do this earlier in the method (unlike moving the iterator forward) because we only add the + // item here + --$c; + } catch (Exception\InvalidPathException $e) { + } } return $items; } -- GitLab