Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
die_coolen_jungs
our_own_cloud_project
Commits
d3752ca1
Commit
d3752ca1
authored
Mar 28, 2015
by
Vincent Petry
Browse files
Merge pull request #15289 from owncloud/min-upload-limit
Require minimum 1 MiB upload limit
parents
3f891c26
ab991458
Changes
1
Show whitespace changes
Inline
Side-by-side
lib/private/files.php
View file @
d3752ca1
...
...
@@ -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
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment