Fixes an issue with the upload of malware samples not generating an md5

hash if the file is too large
pull/217/head
iglocska 2013-07-26 10:13:44 +02:00
parent 8bf54e7c01
commit b3f6032857
1 changed files with 1 additions and 1 deletions

View File

@ -297,7 +297,7 @@ class AttributesController extends AppController {
$this->request->data['Attribute']['type'] = "malware-sample";
// Validate filename
if (!preg_match('@^[\w-,\s]+\.[A-Za-z0-9_]{2,4}$@', $filename)) throw new Exception ('Filename not allowed');
$this->request->data['Attribute']['value'] = $filename . '|' . $tmpfile->md5(); // TODO gives problems with bigger files
$this->request->data['Attribute']['value'] = $filename . '|' . hash_file('md5', $tmpfile->path); // TODO gives problems with bigger files
$sha256 = (hash_file('sha256', $tmpfile->path));
$sha1 = (hash_file('sha1', $tmpfile->path));
$this->request->data['Attribute']['to_ids'] = 1; // LATER let user choose to send this to IDS