From 04a63e05e628a3d2543e34f805922f7607481b95 Mon Sep 17 00:00:00 2001 From: iglocska Date: Sat, 26 Dec 2015 11:53:59 +0100 Subject: [PATCH] Fixes a bug on invalid event IDs passed to the STIX export causing long execution times, fixes #747 - Backported from 2.4 - Running a stix export for a specific ID that doesn't exist results in a full STIX export for the user (events visible to the user) - This leads for an unnecesarily long export process when a quick export is expected --- VERSION.json | 2 +- app/Model/Event.php | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/VERSION.json b/VERSION.json index 810769f6a..3e5af58aa 100644 --- a/VERSION.json +++ b/VERSION.json @@ -1 +1 @@ -{"major":2, "minor":3, "hotfix":178} +{"major":2, "minor":3, "hotfix":179} diff --git a/app/Model/Event.php b/app/Model/Event.php index 28165ec11..b936f61b7 100755 --- a/app/Model/Event.php +++ b/app/Model/Event.php @@ -1770,7 +1770,9 @@ class Event extends AppModel { $eventIDs = $this->Attribute->dissectArgs($id); $tagIDs = $this->Attribute->dissectArgs($tags); $idList = $this->getAccessibleEventIds($eventIDs[0], $eventIDs[1], $tagIDs[0], $tagIDs[1]); + if (empty($idList)) throw new Exception('Invalid Event(s).'); $events = $this->fetchEvent(null, $idList, $org, $isSiteAdmin, false, false, $from, $to, $last); + if (empty($events)) throw new Exception('Invalid Event(s).'); // If a second argument is passed (and it is either "yes", "true", or 1) base64 encode all of the attachments if ($attachments == "yes" || $attachments == "true" || $attachments == 1) { foreach ($events as &$event) {