From 260ee945523a45b3a46c2387967f20ee4fe53800 Mon Sep 17 00:00:00 2001 From: Michael Dale Date: Thu, 6 Aug 2009 22:08:40 +0000 Subject: [PATCH] * added check to chunk uploads to make sure we have not append beyond $wgMaxUploadSize size --- includes/upload/UploadFromChunks.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/includes/upload/UploadFromChunks.php b/includes/upload/UploadFromChunks.php index 9d8ab3b267..5121a9507b 100644 --- a/includes/upload/UploadFromChunks.php +++ b/includes/upload/UploadFromChunks.php @@ -216,6 +216,7 @@ class UploadFromChunks extends UploadBase { // append the given chunk to the temporary uploaded file. (if no temporary uploaded file exists created it. function doChunkAppend(){ + global $wgMaxUploadSize; // if we don't have a mTempAppendPath to generate a file from the chunk packaged var: if( !$this->mTempAppendPath ){ // get temp name: @@ -228,11 +229,17 @@ class UploadFromChunks extends UploadBase { } return $status; } else { + //check to make sure we have not expanded beyond $wgMaxUploadSize + if( ( filesize( $this->mTempAppendPath ) + filesize( $this->mTempPath ) ) > $wgMaxUploadSize ) + $status = Status::newFatal( 'largefileserver' ); + if( is_file( $this->getRealPath( $this->mTempAppendPath ) ) ){ $status = $this->appendToUploadFile( $this->mTempAppendPath, $this->mTempPath ); } else { $status = Status::newFatal( 'filenotfound', $this->mTempAppendPath ); } + + return $status; } } -- 2.20.1