]> source.dussan.org Git - nextcloud-server.git/commitdiff
Check array size, before using the 3rd element from it
authorJoas Schilling <nickvergessen@gmx.de>
Mon, 12 Jan 2015 16:05:51 +0000 (17:05 +0100)
committerJoas Schilling <nickvergessen@gmx.de>
Mon, 12 Jan 2015 16:05:51 +0000 (17:05 +0100)
apps/files_encryption/lib/proxy.php

index 3ee7d83f04c3f4e097ea1bc6816aa8d84f6e609a..4972e1dffd68aad951cce6016b3a002371515be3 100644 (file)
@@ -59,6 +59,15 @@ class Proxy extends \OC_FileProxy {
                $parts = explode('/', $path);
 
                // we only encrypt/decrypt files in the files and files_versions folder
+               if (sizeof($parts) < 3) {
+                       /**
+                        * Less then 3 parts means, we can't match:
+                        * - /{$uid}/files/* nor
+                        * - /{$uid}/files_versions/*
+                        * So this is not a path we are looking for.
+                        */
+                       return true;
+               }
                if(
                        strpos($path, '/' . $uid . '/files/') !== 0 &&
                        !($parts[2] === 'files_versions' && \OCP\User::userExists($parts[1]))) {