mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-25 02:51:35 +02:00
[ticket/12755] Terminate upload loop if upload reaches filesize
Terminate the upload loop if the expected filesize has been reached instead of trying to read more bytes until the timeout has been reached. PHPBB3-12755
This commit is contained in:
@@ -803,13 +803,23 @@ class fileupload
|
||||
|
||||
$get_info = false;
|
||||
$data = '';
|
||||
$length = false;
|
||||
$timer_stop = time() + $this->upload_timeout;
|
||||
|
||||
while (!@feof($fsock))
|
||||
while (!($length && $filesize >= $length) && !@feof($fsock))
|
||||
{
|
||||
if ($get_info)
|
||||
{
|
||||
$block = @fread($fsock, 1024);
|
||||
if ($length)
|
||||
{
|
||||
// Don't attempt to read past end of file if server indicated length
|
||||
$block = @fread($fsock, min($length - $filesize, 1024));
|
||||
}
|
||||
else
|
||||
{
|
||||
$block = @fread($fsock, 1024);
|
||||
}
|
||||
|
||||
$filesize += strlen($block);
|
||||
|
||||
if ($remote_max_filesize && $filesize > $remote_max_filesize)
|
||||
|
Reference in New Issue
Block a user