Skip to content

Commit

Permalink
Don't do a final move for invalid/malicious files. See #333.
Browse files Browse the repository at this point in the history
  • Loading branch information
JimMackin authored and willrennie committed Aug 7, 2015
1 parent b2e2bee commit a4a1884
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions modules/Configurator/UploadFileCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,13 @@
if($upload->confirm_upload()) {
$upload_dir = 'upload://' . $upload_path;
UploadStream::ensureDir($upload_dir);
if(!verify_uploaded_image($upload->temp_file_location, $returnArray['forQuotes'] == 'quotes')){
$returnArray['data']='other';
$returnArray['path'] = '';
echo $json->encode($returnArray);
sugar_cleanup();
exit();
}
$file_name = $upload_dir."/".$upload->get_stored_file_name();
if($upload->final_move($file_name)) {
$upload_ok = true;
Expand Down

0 comments on commit a4a1884

Please sign in to comment.