diff --git a/lib/helper.php b/lib/helper.php
index 47292c56ea8e08e15a345e6882463ca285aa83b0..e7c9ac8015d1fa70883f52087a2f6142da2778d4 100644
--- a/lib/helper.php
+++ b/lib/helper.php
@@ -633,7 +633,7 @@ class OC_Helper {
 	 * @return bool
 	 */
 	public static function issubdirectory($sub, $parent) {
-		if (strpos(realpath($sub), realpath($parent)) !== false) {
+		if (strpos(realpath($sub), realpath($parent)) === 0) {
 			return true;
 		}
 		return false;