]> source.dussan.org Git - nextcloud-server.git/commitdiff
Adjusting count on read
authorjknockaert <jasper@knockaert.nl>
Thu, 2 Apr 2015 14:17:25 +0000 (16:17 +0200)
committerThomas Müller <thomas.mueller@tmit.eu>
Tue, 7 Apr 2015 11:30:31 +0000 (13:30 +0200)
lib/private/files/stream/encryption.php

index fdfe73d99c53b94214897c0938fe768747f678bc..9ef666d78eda8d8bd938d0c59e8d4b0ffaffc932 100644 (file)
@@ -249,9 +249,10 @@ class Encryption extends Wrapper {
 
                // skip the header if we read the file from the beginning
                if ($this->position === 0) {
-                       parent::stream_read($this->util->getBlockSize());
+                       parent::stream_read($this->util->getHeaderSize());
                }
 
+               $count = min($count, $this->unencryptedSize - $this->position);
                while ($count > 0) {
                        $remainingLength = $count;
                        // update the cache of the current block