From b2b7d99302ebbcf7db5288476ef982f9871e3864 Mon Sep 17 00:00:00 2001 From: Michael Gapczynski Date: Tue, 12 Jul 2011 18:22:59 -0400 Subject: [PATCH] Add checks in opendir() to prevent including the current directory or parent --- apps/files_sharing/sharedstorage.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/apps/files_sharing/sharedstorage.php b/apps/files_sharing/sharedstorage.php index b0770cbfdba..a547560659a 100644 --- a/apps/files_sharing/sharedstorage.php +++ b/apps/files_sharing/sharedstorage.php @@ -98,10 +98,12 @@ class OC_FILESTORAGE_SHARED extends OC_FILESTORAGE { $targets[] = basename($item['target']); } while (($filename = readdir($dh)) !== false) { - if (!in_array($filename, $sources)) { - $files[] = $filename; - } else { - $files[] = $targets[array_search($filename, $sources)]; + if ($filename != "." && $filename != "..") { + if (!in_array($filename, $sources)) { + $files[] = $filename; + } else { + $files[] = $targets[array_search($filename, $sources)]; + } } } $FAKEDIRS['shared'] = $files;