Skip to content

Commit 961bf25

Browse files
committed
make length max of length of buffer
1 parent 285f312 commit 961bf25

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/Utils/Buffer.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ public static function read(string $buffer, int &$offset, int $length): string
3535
{
3636
$out = substr($buffer, $offset, $length);
3737
$offset += $length;
38+
if ($offset > ($max = strlen($buffer))) {
39+
$offset = $max;
40+
}
3841
return $out;
3942
}
4043

0 commit comments

Comments
 (0)