Commit b62fd521 authored by Sebastian Kummer's avatar Sebastian Kummer

ZP-936 Only read 4 additional bytes when we need to truncate and are at

end of stream.

Released under the Affero GNU General Public License (AGPL) version 3.
parent 8cabbd51
......@@ -100,8 +100,9 @@ class MAPIStreamWrapper {
$len = ($this->position + $len > $this->streamlength) ? ($this->streamlength - $this->position) : $len;
// read 4 additional bytes from the stream so we can always truncate correctly
if ($this->toTruncate)
if ($this->toTruncate && $this->position+$len >= $this->streamlength) {
$len += 4;
}
if ($this->mapistream) {
$data = mapi_stream_read($this->mapistream, $len);
}
......@@ -165,7 +166,7 @@ class MAPIStreamWrapper {
* @param int $new_size
* @return boolean
*/
public function stream_truncate ($new_size) {
public function stream_truncate($new_size) {
$this->streamlength = $new_size;
$this->toTruncate = true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment