summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2015-01-12 17:58:36 +0100
committerMorris Jobke <hey@morrisjobke.de>2015-01-12 17:58:36 +0100
commitd36a2c8b04f276d3016ed3266acf5476c66ed166 (patch)
tree6aa1e175f732cc22de8b26c2558cddc92b7eab58
parent58b985b4c08d773aa1576c21236866b7b4e2839e (diff)
parent5c03e2207b45ca2a087711537ceb62f35b3b7996 (diff)
downloadnextcloud-server-d36a2c8b04f276d3016ed3266acf5476c66ed166.tar.gz
nextcloud-server-d36a2c8b04f276d3016ed3266acf5476c66ed166.zip
Merge pull request #13285 from owncloud/fix-encryption-check-number-of-parts
Check array size, before using the 3rd element from it
-rw-r--r--apps/files_encryption/lib/proxy.php9
1 files changed, 9 insertions, 0 deletions
diff --git a/apps/files_encryption/lib/proxy.php b/apps/files_encryption/lib/proxy.php
index 3ee7d83f04c..4972e1dffd6 100644
--- a/apps/files_encryption/lib/proxy.php
+++ b/apps/files_encryption/lib/proxy.php
@@ -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]))) {