From d0455c5819099751fb8614a76c272a23c6494b65 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 21 Jun 2012 17:37:53 +0200 Subject: truncate decrypted files based on filelength --- apps/files_encryption/lib/crypt.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'apps/files_encryption/lib/crypt.php') diff --git a/apps/files_encryption/lib/crypt.php b/apps/files_encryption/lib/crypt.php index 4c0ffa978ed..1c90954cec8 100644 --- a/apps/files_encryption/lib/crypt.php +++ b/apps/files_encryption/lib/crypt.php @@ -206,12 +206,16 @@ class OC_Crypt { /** * decrypt data in 8192b sized blocks */ - public static function blockDecrypt($data, $key=''){ + public static function blockDecrypt($data, $key='',$maxLength=0){ $result=''; while(strlen($data)){ $result.=self::decrypt(substr($data,0,8192),$key); $data=substr($data,8192); } - return rtrim($result, "\0"); + if($maxLength>0){ + return substr($result,0,$maxLength); + }else{ + return rtrim($result, "\0"); + } } } -- cgit v1.2.3