diff options
author | Arthur Schiwon <blizzz@owncloud.com> | 2013-09-04 13:06:04 +0200 |
---|---|---|
committer | Arthur Schiwon <blizzz@owncloud.com> | 2013-09-04 13:06:04 +0200 |
commit | ec3639dc7a28348b136d2008e692cffe8c3753ad (patch) | |
tree | 3d197d325496925be0ddee1f1ab22c48c7c817a1 /apps/files_external/lib/smb.php | |
parent | 09187f3b3b30e6f810c6afff7332615ed472154e (diff) | |
download | nextcloud-server-ec3639dc7a28348b136d2008e692cffe8c3753ad.tar.gz nextcloud-server-ec3639dc7a28348b136d2008e692cffe8c3753ad.zip |
Always check variable type before using readdir to avoid surprises
Diffstat (limited to 'apps/files_external/lib/smb.php')
-rw-r--r-- | apps/files_external/lib/smb.php | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/apps/files_external/lib/smb.php b/apps/files_external/lib/smb.php index 8e7a28fba1a..ecd4dae0484 100644 --- a/apps/files_external/lib/smb.php +++ b/apps/files_external/lib/smb.php @@ -99,11 +99,13 @@ class SMB extends \OC\Files\Storage\StreamWrapper{ private function shareMTime() { $dh=$this->opendir(''); $lastCtime=0; - while (($file = readdir($dh)) !== false) { - if ($file!='.' and $file!='..') { - $ctime=$this->filemtime($file); - if ($ctime>$lastCtime) { - $lastCtime=$ctime; + if(is_resource($dh)) { + while (($file = readdir($dh)) !== false) { + if ($file!='.' and $file!='..') { + $ctime=$this->filemtime($file); + if ($ctime>$lastCtime) { + $lastCtime=$ctime; + } } } } |