aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--contrib/hiredis/dict.c8
-rw-r--r--contrib/hiredis/hiredis.c4
-rw-r--r--contrib/libucl/ucl_parser.c23
-rw-r--r--src/libmime/archives.c4
-rw-r--r--src/libserver/dkim.c1
-rw-r--r--src/libserver/spf.c6
-rw-r--r--src/libutil/ssl_util.c2
-rw-r--r--src/plugins/fuzzy_check.c13
8 files changed, 42 insertions, 19 deletions
diff --git a/contrib/hiredis/dict.c b/contrib/hiredis/dict.c
index e17a62546..0fbc1b4cf 100644
--- a/contrib/hiredis/dict.c
+++ b/contrib/hiredis/dict.c
@@ -172,9 +172,11 @@ static int dictReplace(dict *ht, void *key, void *val) {
* as the previous one. In this context, think to reference counting,
* you want to increment (set), and then decrement (free), and not the
* reverse. */
- auxentry = *entry;
- dictSetHashVal(ht, entry, val);
- dictFreeEntryVal(ht, &auxentry);
+ if (entry) {
+ auxentry = *entry;
+ dictSetHashVal(ht, entry, val);
+ dictFreeEntryVal(ht, &auxentry);
+ }
return 0;
}
diff --git a/contrib/hiredis/hiredis.c b/contrib/hiredis/hiredis.c
index 2b876d913..0f87bc323 100644
--- a/contrib/hiredis/hiredis.c
+++ b/contrib/hiredis/hiredis.c
@@ -710,6 +710,8 @@ redisContext *redisConnectNonBlock(const char *ip, int port) {
redisContext *redisConnectBindNonBlock(const char *ip, int port,
const char *source_addr) {
redisContext *c = redisContextInit();
+ if (c == NULL)
+ return NULL;
c->flags &= ~REDIS_BLOCK;
redisContextConnectBindTcp(c,ip,port,NULL,source_addr);
return c;
@@ -718,6 +720,8 @@ redisContext *redisConnectBindNonBlock(const char *ip, int port,
redisContext *redisConnectBindNonBlockWithReuse(const char *ip, int port,
const char *source_addr) {
redisContext *c = redisContextInit();
+ if (c == NULL)
+ return NULL;
c->flags &= ~REDIS_BLOCK;
c->flags |= REDIS_REUSEADDR;
redisContextConnectBindTcp(c,ip,port,NULL,source_addr);
diff --git a/contrib/libucl/ucl_parser.c b/contrib/libucl/ucl_parser.c
index d6b8eb656..11b871259 100644
--- a/contrib/libucl/ucl_parser.c
+++ b/contrib/libucl/ucl_parser.c
@@ -1608,8 +1608,17 @@ ucl_parse_value (struct ucl_parser *parser, struct ucl_chunk *chunk)
break;
case '{':
obj = ucl_parser_get_container (parser);
+ if (obj == NULL) {
+ return false;
+ }
/* We have a new object */
- obj = ucl_parser_add_container (obj, parser, false, parser->stack->level);
+ if (parser->stack) {
+ obj = ucl_parser_add_container (obj, parser, false,
+ parser->stack->level);
+ }
+ else {
+ return false;
+ }
if (obj == NULL) {
return false;
}
@@ -1620,8 +1629,18 @@ ucl_parse_value (struct ucl_parser *parser, struct ucl_chunk *chunk)
break;
case '[':
obj = ucl_parser_get_container (parser);
+ if (obj == NULL) {
+ return false;
+ }
/* We have a new array */
- obj = ucl_parser_add_container (obj, parser, true, parser->stack->level);
+ if (parser->stack) {
+ obj = ucl_parser_add_container (obj, parser, true,
+ parser->stack->level);
+ }
+ else {
+ return false;
+ }
+
if (obj == NULL) {
return false;
}
diff --git a/src/libmime/archives.c b/src/libmime/archives.c
index 118da921c..28e898bee 100644
--- a/src/libmime/archives.c
+++ b/src/libmime/archives.c
@@ -700,7 +700,7 @@ rspamd_7zip_read_bits (struct rspamd_task *task,
struct rspamd_archive *arch, guint nbits,
guint *pbits_set)
{
- unsigned mask, avail, i;
+ unsigned mask = 0, avail = 0, i;
gboolean bit_set = 0;
for (i = 0; i < nbits; i++) {
@@ -710,7 +710,7 @@ rspamd_7zip_read_bits (struct rspamd_task *task,
mask = 0x80;
}
- bit_set = (avail & mask)?1:0;
+ bit_set = (avail & mask) ? 1 : 0;
if (bit_set && pbits_set) {
(*pbits_set) ++;
diff --git a/src/libserver/dkim.c b/src/libserver/dkim.c
index 0eaa9937e..12bc146ab 100644
--- a/src/libserver/dkim.c
+++ b/src/libserver/dkim.c
@@ -2820,6 +2820,7 @@ rspamd_dkim_sign (struct rspamd_task *task, const gchar *selector,
switch (ctx->common.type) {
case RSPAMD_DKIM_NORMAL:
+ default:
hname = RSPAMD_DKIM_SIGNHEADER;
break;
case RSPAMD_DKIM_ARC_SIG:
diff --git a/src/libserver/spf.c b/src/libserver/spf.c
index a29e77c07..edce244b9 100644
--- a/src/libserver/spf.c
+++ b/src/libserver/spf.c
@@ -1474,9 +1474,9 @@ static const gchar *
expand_spf_macro (struct spf_record *rec, struct spf_resolved_element *resolved,
const gchar *begin)
{
- const gchar *p, *macro_value;
- gchar *c, *new, *tmp, delim;
- gsize len = 0, slen = 0, macro_len;
+ const gchar *p, *macro_value = NULL;
+ gchar *c, *new, *tmp, delim = '.';
+ gsize len = 0, slen = 0, macro_len = 0;
gint state = 0, ndelim = 0;
gchar ip_buf[INET6_ADDRSTRLEN + 1];
gboolean need_expand = FALSE, reversed;
diff --git a/src/libutil/ssl_util.c b/src/libutil/ssl_util.c
index 5b181f1bc..6d76beabd 100644
--- a/src/libutil/ssl_util.c
+++ b/src/libutil/ssl_util.c
@@ -364,7 +364,7 @@ rspamd_tls_set_error (gint retcode, const gchar *stage, GError **err)
{
GString *reason;
gchar buf[120];
- gint err_code, last_err;
+ gint err_code = 0, last_err = 0;
reason = g_string_sized_new (sizeof (buf));
diff --git a/src/plugins/fuzzy_check.c b/src/plugins/fuzzy_check.c
index acf36a975..a7a198dad 100644
--- a/src/plugins/fuzzy_check.c
+++ b/src/plugins/fuzzy_check.c
@@ -2830,7 +2830,7 @@ fuzzy_process_handler (struct rspamd_http_connection_entry *conn_ent,
struct fuzzy_rule *rule;
struct rspamd_controller_session *session = conn_ent->ud;
struct rspamd_task *task, **ptask;
- gboolean processed = FALSE, res = TRUE, skip;
+ gboolean processed = FALSE, res = TRUE, skip = FALSE;
guint i;
GError **err;
GPtrArray *commands;
@@ -2935,7 +2935,7 @@ fuzzy_process_handler (struct rspamd_http_connection_entry *conn_ent,
if (is_hash) {
GPtrArray *args;
const rspamd_ftok_t *arg;
- guint i;
+ guint j;
args = rspamd_http_message_find_header_multiple (msg, "Hash");
@@ -2943,8 +2943,8 @@ fuzzy_process_handler (struct rspamd_http_connection_entry *conn_ent,
struct fuzzy_cmd_io *io;
commands = g_ptr_array_sized_new (args->len);
- for (i = 0; i < args->len; i ++) {
- arg = g_ptr_array_index (args, i);
+ for (j = 0; j < args->len; j ++) {
+ arg = g_ptr_array_index (args, j);
io = fuzzy_cmd_hash (rule, cmd, arg, flag, value,
task->task_pool);
@@ -2996,6 +2996,7 @@ fuzzy_process_handler (struct rspamd_http_connection_entry *conn_ent,
strerror (errno));
rspamd_controller_send_error (conn_ent, 400, "Message sending error");
rspamd_task_free (task);
+
return;
}
else if (!processed) {
@@ -3019,11 +3020,7 @@ fuzzy_process_handler (struct rspamd_http_connection_entry *conn_ent,
}
}
rspamd_task_free (task);
-
- return;
}
-
- return;
}
static int