From e3b1e8c74a0b40cdb54be938bcea4d9b28a7f0b9 Mon Sep 17 00:00:00 2001 From: Jason Kendall Date: Fri, 7 Feb 2020 13:43:11 -0500 Subject: [PATCH] Ensure we only have the last line from the shell command --- app/Model/Event.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/Model/Event.php b/app/Model/Event.php index 7d85cbc0f..fda45714f 100755 --- a/app/Model/Event.php +++ b/app/Model/Event.php @@ -5694,6 +5694,7 @@ class Event extends AppModel } $shell_command .= ' ' . escapeshellarg(Configure::read('MISP.default_event_distribution')) . ' ' . escapeshellarg(Configure::read('MISP.default_attribute_distribution')) . ' 2>' . APP . 'tmp/logs/exec-errors.log'; $result = shell_exec($shell_command); + $result = end(preg_split("/\r\n|\n|\r/", trim($result))); $tempFile = file_get_contents($tempFilePath); unlink($tempFilePath); if (trim($result) == '1') {