commit 063784d: [Minor] Maps: Check the object before usage

Vsevolod Stakhov vsevolod at highsecure.ru
Wed Jan 23 15:49:03 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-01-23 15:05:31 +0000
URL: https://github.com/rspamd/rspamd/commit/063784dd311b10484834292e7ab401941ccf502a

[Minor] Maps: Check the object before usage

---
 src/libutil/map_helpers.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/libutil/map_helpers.c b/src/libutil/map_helpers.c
index 4b2b41fcb..ece3017ab 100644
--- a/src/libutil/map_helpers.c
+++ b/src/libutil/map_helpers.c
@@ -1142,7 +1142,7 @@ rspamd_match_regexp_map_single (struct rspamd_regexp_map_helper *map,
 
 	g_assert (in != NULL);
 
-	if (map == NULL || len == 0) {
+	if (map == NULL || len == 0 || map->regexps == NULL) {
 		return NULL;
 	}
 
@@ -1233,7 +1233,7 @@ rspamd_match_regexp_map_all (struct rspamd_regexp_map_helper *map,
 
 	g_assert (in != NULL);
 
-	if (map == NULL || len == 0) {
+	if (map == NULL || map->regexps == NULL || len == 0) {
 		return NULL;
 	}
 
@@ -1294,7 +1294,7 @@ rspamd_match_hash_map (struct rspamd_hash_map_helper *map, const gchar *in)
 	khiter_t k;
 	struct rspamd_map_helper_value *val;
 
-	if (map == NULL) {
+	if (map == NULL || map->htb == NULL) {
 		return NULL;
 	}
 
@@ -1316,7 +1316,7 @@ rspamd_match_radix_map (struct rspamd_radix_map_helper *map,
 {
 	struct rspamd_map_helper_value *val;
 
-	if (map == NULL) {
+	if (map == NULL || map->trie == NULL) {
 		return NULL;
 	}
 
@@ -1338,7 +1338,7 @@ rspamd_match_radix_map_addr (struct rspamd_radix_map_helper *map,
 {
 	struct rspamd_map_helper_value *val;
 
-	if (map == NULL) {
+	if (map == NULL || map->trie == NULL) {
 		return NULL;
 	}
 


More information about the Commits mailing list