From 945bdb61b7486d61008656cff1c60410e65a387a Mon Sep 17 00:00:00 2001 From: bmeeks8 Date: Fri, 3 Jul 2015 23:25:21 -0400 Subject: Verify snort_widget file handle before trying to use it. --- config/snort/snort_alerts.widget.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/config/snort/snort_alerts.widget.php b/config/snort/snort_alerts.widget.php index 96c70562..2b7a10c7 100644 --- a/config/snort/snort_alerts.widget.php +++ b/config/snort/snort_alerts.widget.php @@ -125,7 +125,10 @@ function snort_widget_get_alerts() { /* 0 1 2 3 4 5 6 7 8 9 10 11 12 */ /* File format: timestamp,generator_id,sig_id,sig_rev,msg,proto,src,srcport,dst,dstport,id,classification,priority */ - $fd = fopen("/tmp/alert_snort{$snort_uuid}", "r"); + if (!$fd = fopen("/tmp/alert_snort{$snort_uuid}", "r")) { + log_error(gettext("[Snort Widget] Failed to open file /tmp/alert_snort{$snort_uuid}")); + continue; + } while (($fields = fgetcsv($fd, 1000, ',', '"')) !== FALSE) { if(count($fields) < 13) continue; -- cgit v1.2.3