diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2011-07-21 17:35:29 +0400 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2011-07-21 17:35:29 +0400 |
commit | fd6c856b34c8fda53b7e45e3dcc17625206ed4fb (patch) | |
tree | b4c8d1c62937038cb39bdcf7879110525fb05480 /src/plugins | |
parent | 875d1dd367eb433ae77a092148f483e9b9449a47 (diff) | |
download | rspamd-fd6c856b34c8fda53b7e45e3dcc17625206ed4fb.tar.gz rspamd-fd6c856b34c8fda53b7e45e3dcc17625206ed4fb.zip |
Add workaround for clang under linux.
Fix problems found by static analyzing.
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/fuzzy_check.c | 2 | ||||
-rw-r--r-- | src/plugins/regexp.c | 21 | ||||
-rw-r--r-- | src/plugins/surbl.c | 2 |
3 files changed, 13 insertions, 12 deletions
diff --git a/src/plugins/fuzzy_check.c b/src/plugins/fuzzy_check.c index 93ba4bf25..eafbbeb90 100644 --- a/src/plugins/fuzzy_check.c +++ b/src/plugins/fuzzy_check.c @@ -271,7 +271,7 @@ parse_servers_string (gchar *str) else { fuzzy_module_ctx->servers[fuzzy_module_ctx->servers_num].port = port; fuzzy_module_ctx->servers[fuzzy_module_ctx->servers_num].name = name; - memcpy (&fuzzy_module_ctx->servers[fuzzy_module_ctx->servers_num].addr, hent->h_addr, sizeof (struct in_addr)); + memcpy (&fuzzy_module_ctx->servers[fuzzy_module_ctx->servers_num].addr, &addr, sizeof (struct in_addr)); fuzzy_module_ctx->servers_num++; } diff --git a/src/plugins/regexp.c b/src/plugins/regexp.c index d2e22a14a..89f1ed5c3 100644 --- a/src/plugins/regexp.c +++ b/src/plugins/regexp.c @@ -1427,23 +1427,24 @@ lua_regexp_match (lua_State *L) struct worker_task *task; const gchar *re_text; struct rspamd_regexp *re; - gint r; + gint r = 0; luaL_argcheck (L, ud != NULL, 1, "'task' expected"); - task = *((struct worker_task **)ud); + task = ud ? *((struct worker_task **)ud) : NULL; re_text = luaL_checkstring (L, 2); - /* This is a regexp */ - if ((re = re_cache_check (re_text, task->cfg->cfg_pool)) == NULL) { - re = parse_regexp (task->cfg->cfg_pool, (gchar *)re_text, task->cfg->raw_mode); - if (re == NULL) { - msg_warn ("cannot compile regexp for function"); - return FALSE; + if (task != NULL) { + if ((re = re_cache_check (re_text, task->cfg->cfg_pool)) == NULL) { + re = parse_regexp (task->cfg->cfg_pool, (gchar *)re_text, task->cfg->raw_mode); + if (re == NULL) { + msg_warn ("cannot compile regexp for function"); + return FALSE; + } + re_cache_add ((gchar *)re_text, re, task->cfg->cfg_pool); } - re_cache_add ((gchar *)re_text, re, task->cfg->cfg_pool); + r = process_regexp (re, task, NULL, 0, NULL); } - r = process_regexp (re, task, NULL, 0, NULL); lua_pushboolean (L, r == 1); return 1; diff --git a/src/plugins/surbl.c b/src/plugins/surbl.c index ba4559015..4e7194ed0 100644 --- a/src/plugins/surbl.c +++ b/src/plugins/surbl.c @@ -528,7 +528,7 @@ format_surbl_request (memory_pool_t * pool, f_str_t * hostname, struct suffix_it } else if (is_numeric && dots_num == 0) { /* This is number */ - if ((suffix->options & SURBL_OPTION_NOIP) != 0) { + if (suffix != NULL && (suffix->options & SURBL_OPTION_NOIP) != 0) { /* Ignore such requests */ msg_info ("ignore request of ip url for list %s", suffix->symbol); return NULL; |