commit ad94be0: [Minor] Stat: Fail-safety fix for object expansion
Vsevolod Stakhov
vsevolod at highsecure.ru
Mon Feb 11 13:21:04 UTC 2019
Author: Vsevolod Stakhov
Date: 2019-02-11 12:31:06 +0000
URL: https://github.com/rspamd/rspamd/commit/ad94be0d7234b84b2b7fb3a90af6110301dd52e8
[Minor] Stat: Fail-safety fix for object expansion
---
src/libstat/backends/redis_backend.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
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");
More information about the Commits
mailing list