From d981652f59caf705fe1f066c57fb9058ed7073cf Mon Sep 17 00:00:00 2001 From: Bill Meeks Date: Sun, 20 Jan 2013 21:31:19 -0500 Subject: Fix build_sid_msg_map() and snort_load_rules_map() to check arg type. --- config/snort/snort.inc | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'config/snort') diff --git a/config/snort/snort.inc b/config/snort/snort.inc index 93db9424..49b9d4df 100755 --- a/config/snort/snort.inc +++ b/config/snort/snort.inc @@ -737,10 +737,12 @@ function build_sid_msg_map($rules_path, $sid_file) { /* or an array of filenames to read. Set our $rule_files */ /* variable accordingly. If we can't figure it out, return */ /* an empty rules map array. */ - if (is_dir($rules_path)) - $rule_files = glob($rules_path . "*.rules"); - elseif (is_file($rules_path)) - $rule_files = (array)$rules_path; + if (is_string($rules_path)) { + if (is_dir($rules_path)) + $rule_files = glob($rules_path . "*.rules"); + elseif (is_file($rules_path)) + $rule_files = (array)$rules_path; + } elseif (is_array($rules_path)) $rule_files = $rules_path; else @@ -921,10 +923,12 @@ function snort_load_rules_map($rules_path) { /* or an array of filenames to read. Set our $rule_files */ /* variable accordingly. If we can't figure it out, return */ /* an empty rules map array. */ - if (is_dir($rules_path)) - $rule_files = glob($rules_path . "*.rules"); - elseif (is_file($rules_path)) - $rule_files = (array)$rules_path; + if (is_string($rules_path)) { + if (is_dir($rules_path)) + $rule_files = glob($rules_path . "*.rules"); + elseif (is_file($rules_path)) + $rule_files = (array)$rules_path; + } elseif (is_array($rules_path)) $rule_files = $rules_path; else -- cgit v1.2.3