From 8c8b8596c81cc762630d5472158ad8eb7191d244 Mon Sep 17 00:00:00 2001 From: Gurvinder Singh Date: Sun, 27 Dec 2009 19:38:31 +0530 Subject: [PATCH] fixed bug 18 --- src/suricata.c | 8 +++++++- src/util-hashlist.c | 6 ++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/suricata.c b/src/suricata.c index f675a115b6..649b29dbe4 100644 --- a/src/suricata.c +++ b/src/suricata.c @@ -422,6 +422,8 @@ int main(int argc, char **argv) /* Load yaml configuration file if provided. */ if (conf_filename != NULL) { ConfYamlLoadFile(conf_filename); + } else { + SCLogError(SC_ERR_OPENING_FILE, "Configuration file has not been provided"); } if (dump_config) { @@ -593,7 +595,11 @@ int main(int argc, char **argv) LogFileCtx *au2a_logfile_ctx = Unified2AlertInitCtx(NULL); if (SigLoadSignatures(de_ctx, sig_file) < 0) { - SCLogError(SC_ERR_NO_RULES_LOADED, "Loading signatures failed.\n"); + if (sig_file == NULL) { + SCLogError(SC_ERR_OPENING_FILE, "Signature file has not been provided"); + } else { + SCLogError(SC_ERR_NO_RULES_LOADED, "Loading signatures failed."); + } } struct timeval start_time; diff --git a/src/util-hashlist.c b/src/util-hashlist.c index 4203ad1c3d..6301fe4270 100644 --- a/src/util-hashlist.c +++ b/src/util-hashlist.c @@ -220,6 +220,12 @@ char HashListTableDefaultCompare(void *data1, uint16_t len1, void *data2, uint16 } void *HashListTableLookup(HashListTable *ht, void *data, uint16_t datalen) { + + if (ht == NULL) { + SCLogDebug("Hash List table is NULL"); + return NULL; + } + uint32_t hash = ht->Hash(ht, data, datalen); if (ht->array[hash] == NULL) {