download: do not read excess (fix #592)

Signed-off-by: Varun Patil <radialapps@gmail.com>
pull/602/head
Varun Patil 2023-04-19 16:44:19 -07:00
parent da192ee70e
commit 35754c36fa
1 changed files with 2 additions and 1 deletions

View File

@ -206,7 +206,8 @@ class DownloadController extends GenericApiController
ob_start();
while (!feof($res) && $seekStart <= $seekEnd) {
$buffer = fread($res, 1024 * 1024);
$lenLeft = $seekEnd - $seekStart + 1;
$buffer = fread($res, min(1024 * 1024, $lenLeft));
if (false === $buffer) {
break;
}