mirror of
https://github.com/Piwigo/Piwigo.git
synced 2025-04-28 12:19:57 +03:00
issue #1073 prevents from making uploaded file executable
* for the name of the file in buffer directory, do not use the name given by the user, but the md5 of the name without extension * function add_uploaded_file deletes uploaded file if not expected
This commit is contained in:
parent
7e154ab093
commit
fa8996e10f
2 changed files with 6 additions and 0 deletions
|
@ -237,11 +237,13 @@ SELECT
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
unlink($source_filepath);
|
||||||
die('unexpected file type');
|
die('unexpected file type');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
unlink($source_filepath);
|
||||||
die('forbidden file type');
|
die('forbidden file type');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1348,6 +1348,10 @@ function ws_images_upload($params, $service)
|
||||||
$fileName = uniqid("file_");
|
$fileName = uniqid("file_");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// change the name of the file in the buffer to avoid any unexpected
|
||||||
|
// extension. Function add_uploaded_file will eventually clean the mess.
|
||||||
|
$fileName = md5($fileName);
|
||||||
|
|
||||||
$filePath = $upload_dir.DIRECTORY_SEPARATOR.$fileName;
|
$filePath = $upload_dir.DIRECTORY_SEPARATOR.$fileName;
|
||||||
|
|
||||||
// Chunking might be enabled
|
// Chunking might be enabled
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue