diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/libcryptobox/cryptobox.c | 2 | ||||
-rw-r--r-- | src/libserver/dkim.c | 2 | ||||
-rw-r--r-- | src/libutil/expression.c | 11 | ||||
-rw-r--r-- | src/libutil/str_util.c | 4 | ||||
-rw-r--r-- | src/libutil/upstream.c | 3 | ||||
-rw-r--r-- | src/libutil/util.c | 6 | ||||
-rw-r--r-- | src/lua/lua_cdb.c | 8 | ||||
-rw-r--r-- | src/lua/lua_redis.c | 6 |
8 files changed, 31 insertions, 11 deletions
diff --git a/src/libcryptobox/cryptobox.c b/src/libcryptobox/cryptobox.c index fe2cff29e..1085906de 100644 --- a/src/libcryptobox/cryptobox.c +++ b/src/libcryptobox/cryptobox.c @@ -676,7 +676,7 @@ rspamd_cryptobox_encrypt_update (void *enc_ctx, const guchar *in, gsize inlen, EVP_CIPHER_CTX *s = enc_ctx; gint r; - r = outlen ? *outlen : inlen; + r = inlen; g_assert (EVP_EncryptUpdate (s, out, &r, in, inlen) == 1); if (outlen) { diff --git a/src/libserver/dkim.c b/src/libserver/dkim.c index 13aa9dc17..f36299444 100644 --- a/src/libserver/dkim.c +++ b/src/libserver/dkim.c @@ -1518,7 +1518,7 @@ rspamd_dkim_canonize_header_simple (rspamd_dkim_context_t *ctx, if (elt && elt->append_crlf) { rspamd_dkim_signature_update (ctx, elt->begin, elt->len + 1); } - else { + else if (elt) { rspamd_dkim_signature_update (ctx, elt->begin, elt->len); } } diff --git a/src/libutil/expression.c b/src/libutil/expression.c index 12186b796..2bbc5fa3b 100644 --- a/src/libutil/expression.c +++ b/src/libutil/expression.c @@ -476,6 +476,7 @@ rspamd_ast_priority_cmp (GNode *a, GNode *b) struct rspamd_expression_elt *ea = a->data, *eb = b->data; gdouble w1, w2; + /* Special logic for atoms */ if (ea->type == ELT_ATOM && eb->type == ELT_ATOM && ea->priority == eb->priority) { @@ -495,8 +496,18 @@ rspamd_ast_priority_cmp (GNode *a, GNode *b) static gboolean rspamd_ast_resort_traverse (GNode *node, gpointer unused) { + GNode *children, *last; + if (node->children) { + + children = node->children; + last = g_node_last_sibling (children); + /* Needed for utlist compatibility */ + children->prev = last; DL_SORT (node->children, rspamd_ast_priority_cmp); + /* Restore GLIB compatibility */ + children = node->children; + children->prev = NULL; } return FALSE; diff --git a/src/libutil/str_util.c b/src/libutil/str_util.c index 89a6537de..5f4cd1c1e 100644 --- a/src/libutil/str_util.c +++ b/src/libutil/str_util.c @@ -469,13 +469,13 @@ rspamd_encode_base32_buf (const guchar *in, gsize inlen, gchar *out, { static const char b32[]="ybndrfg8ejkmcpqxot1uwisza345h769"; gchar *o, *end; - gsize i, r; + gsize i; gint remain = -1, x; end = out + outlen; o = out; - for (i = 0, r = 0; i < inlen && o < end - 1; i++) { + for (i = 0; i < inlen && o < end - 1; i++) { switch (i % 5) { case 0: /* 8 bits of input and 3 to remain */ diff --git a/src/libutil/upstream.c b/src/libutil/upstream.c index 574cf0667..8bbe48208 100644 --- a/src/libutil/upstream.c +++ b/src/libutil/upstream.c @@ -727,7 +727,7 @@ rspamd_upstream_get_round_robin (struct upstream_list *ups, gboolean use_cur) } } - if (use_cur) { + if (use_cur && selected) { if (selected->cur_weight > 0) { selected->cur_weight--; } @@ -735,6 +735,7 @@ rspamd_upstream_get_round_robin (struct upstream_list *ups, gboolean use_cur) selected->cur_weight = selected->weight; } } + rspamd_mutex_unlock (ups->lock); return selected; diff --git a/src/libutil/util.c b/src/libutil/util.c index 0023a9ba1..1d5f49a61 100644 --- a/src/libutil/util.c +++ b/src/libutil/util.c @@ -1153,12 +1153,6 @@ resolve_stat_filename (rspamd_mempool_t * pool, s += rcptlen; continue; } - else if (*c == '%' && *(c + 1) == 'r') { - c += 2; - memcpy (s, from, fromlen); - s += fromlen; - continue; - } *s++ = *c; } diff --git a/src/lua/lua_cdb.c b/src/lua/lua_cdb.c index de0ac67a0..b0e6df32e 100644 --- a/src/lua/lua_cdb.c +++ b/src/lua/lua_cdb.c @@ -85,6 +85,10 @@ lua_cdb_get_name (lua_State *L) { struct cdb *cdb = lua_check_cdb (L); + if (!cdb) { + lua_error (L); + return 1; + } lua_pushstring (L, cdb->filename); return 1; } @@ -98,6 +102,10 @@ lua_cdb_lookup (lua_State *L) gsize vlen; gint64 vpos; + if (!cdb) { + lua_error (L); + return 1; + } /* * XXX: this code is placed here because event_loop is called inside workers, so start * monitoring on first check, not on creation diff --git a/src/lua/lua_redis.c b/src/lua/lua_redis.c index cc408244a..dcb1af45a 100644 --- a/src/lua/lua_redis.c +++ b/src/lua/lua_redis.c @@ -933,6 +933,12 @@ lua_redis_exec (lua_State *L) gint ret; guint i, nret = 0; + if (ctx == NULL) { + lua_error (L); + + return 1; + } + if (ctx->async) { lua_pushstring (L, "Async redis pipelining is not implemented"); lua_error (L); |