Skip to content
Snippets Groups Projects
Commit d3752ca1 authored by Vincent Petry's avatar Vincent Petry
Browse files

Merge pull request #15289 from owncloud/min-upload-limit

Require minimum 1 MiB upload limit
parents 3f891c26 ab991458
No related branches found
No related tags found
No related merge requests found
......@@ -52,6 +52,8 @@ class OC_Files {
const ZIP_FILES = 2;
const ZIP_DIR = 3;
const UPLOAD_MIN_LIMIT_BYTES = 1048576; // 1 MiB
/**
* @param string $filename
* @param string $name
......@@ -246,15 +248,17 @@ class OC_Files {
* @return bool false on failure, size on success
*/
static function setUploadLimit($size) {
//don't allow user to break his config -- upper boundary
//don't allow user to break his config
if ($size > PHP_INT_MAX) {
//max size is always 1 byte lower than computerFileSize returns
if ($size > PHP_INT_MAX + 1)
return false;
$size -= 1;
} else {
$size = OC_Helper::phpFileSize($size);
}
if ($size < self::UPLOAD_MIN_LIMIT_BYTES) {
return false;
}
$size = OC_Helper::phpFileSize($size);
//don't allow user to break his config -- broken or malicious size input
if (intval($size) === 0) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment