diff options
author | Marc Alexander <admin@m-a-styles.de> | 2014-06-24 19:07:49 +0200 |
---|---|---|
committer | Marc Alexander <admin@m-a-styles.de> | 2014-06-24 19:07:49 +0200 |
commit | 309dbb4ef9d6b2c29aa6294002ce1a7d4da2b099 (patch) | |
tree | 4d315796e42af66952672cf20d9391d59b341039 /phpBB/includes/functions_upload.php | |
parent | 5ee1e07e1731cfa58e815c4a805fb188b0986640 (diff) | |
download | forums-309dbb4ef9d6b2c29aa6294002ce1a7d4da2b099.tar forums-309dbb4ef9d6b2c29aa6294002ce1a7d4da2b099.tar.gz forums-309dbb4ef9d6b2c29aa6294002ce1a7d4da2b099.tar.bz2 forums-309dbb4ef9d6b2c29aa6294002ce1a7d4da2b099.tar.xz forums-309dbb4ef9d6b2c29aa6294002ce1a7d4da2b099.zip |
[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
Diffstat (limited to 'phpBB/includes/functions_upload.php')
-rw-r--r-- | phpBB/includes/functions_upload.php | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/phpBB/includes/functions_upload.php b/phpBB/includes/functions_upload.php index c6e2dddf3d..daa3550205 100644 --- a/phpBB/includes/functions_upload.php +++ b/phpBB/includes/functions_upload.php @@ -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) |