From: Vsevolod Stakhov Date: Mon, 11 Feb 2019 12:31:06 +0000 (+0000) Subject: [Minor] Stat: Fail-safety fix for object expansion X-Git-Tag: 1.9.0~179 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ad94be0d7234b84b2b7fb3a90af6110301dd52e8;p=rspamd.git [Minor] Stat: Fail-safety fix for object expansion --- diff --git a/src/libstat/backends/redis_backend.c b/src/libstat/backends/redis_backend.c index 10d348ac9..d7402db98 100644 --- a/src/libstat/backends/redis_backend.c +++ b/src/libstat/backends/redis_backend.c @@ -151,7 +151,6 @@ rspamd_redis_expand_object (const gchar *pattern, GString *tb; const gchar *rcpt = NULL; gint err_idx; - gboolean expansion_errored = FALSE; g_assert (ctx != NULL); stcf = ctx->stcf; @@ -214,9 +213,6 @@ rspamd_redis_expand_object (const gchar *pattern, if (elt) { tlen += strlen (elt); } - else { - expansion_errored = TRUE; - } break; case 'r': @@ -230,9 +226,6 @@ rspamd_redis_expand_object (const gchar *pattern, if (elt) { tlen += strlen (elt); } - else { - expansion_errored = TRUE; - } break; case 'l': if (stcf->label) { @@ -277,8 +270,8 @@ rspamd_redis_expand_object (const gchar *pattern, } - if (target == NULL || task == NULL || expansion_errored) { - return tlen; + if (target == NULL || task == NULL) { + return -1; } *target = rspamd_mempool_alloc (task->task_pool, tlen + 1); @@ -1305,6 +1298,7 @@ rspamd_redis_parse_classifier_opts (struct redis_stat_ctx *backend, } else { backend->enable_users = FALSE; + backend->cbref_user = -1; } elt = ucl_object_lookup (obj, "prefix");