diff options
author | Robin Appelman <icewind@owncloud.com> | 2012-06-21 17:37:53 +0200 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2012-06-21 17:38:00 +0200 |
commit | d0455c5819099751fb8614a76c272a23c6494b65 (patch) | |
tree | c6068672ac891b51e1ae690515a897995ac9039d /apps/files_encryption/lib/crypt.php | |
parent | 1338279ca02af2444a7277a041bec18aab615774 (diff) | |
download | nextcloud-server-d0455c5819099751fb8614a76c272a23c6494b65.tar.gz nextcloud-server-d0455c5819099751fb8614a76c272a23c6494b65.zip |
truncate decrypted files based on filelength
Diffstat (limited to 'apps/files_encryption/lib/crypt.php')
-rw-r--r-- | apps/files_encryption/lib/crypt.php | 8 |
1 files changed, 6 insertions, 2 deletions
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"); + } } } |