diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-10-30 12:44:11 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-10-30 12:44:11 +0000 |
commit | 9de464d9ad75c4e9bfd13cb73814fd1665ce53f2 (patch) | |
tree | ea4d44a5c8d7b60c84379710ac390d2dc07960ad | |
parent | 7a7791926e0ad43ce69d3ba9cc5c73dc8fa9d3a2 (diff) | |
download | rspamd-9de464d9ad75c4e9bfd13cb73814fd1665ce53f2.tar.gz rspamd-9de464d9ad75c4e9bfd13cb73814fd1665ce53f2.zip |
[Minor] Fix crash where inconsistent fuzzy query was sent
-rw-r--r-- | src/plugins/fuzzy_check.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/plugins/fuzzy_check.c b/src/plugins/fuzzy_check.c index 3eed0da51..58ba610fe 100644 --- a/src/plugins/fuzzy_check.c +++ b/src/plugins/fuzzy_check.c @@ -2960,7 +2960,8 @@ 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 = FALSE; + gboolean processed = FALSE, skip = FALSE; + gint res = 0; guint i; GError **err; GPtrArray *commands; @@ -3118,19 +3119,24 @@ fuzzy_process_handler (struct rspamd_http_connection_entry *conn_ent, } } - - if (res) { + if (res > 0) { processed = TRUE; } } if (res == -1) { - msg_warn_task ("cannot send fuzzy request: %s", - strerror (errno)); - rspamd_controller_send_error (conn_ent, 400, "Message sending error"); - rspamd_task_free (task); + if (!processed) { + msg_warn_task ("cannot send fuzzy request: %s", + strerror (errno)); + rspamd_controller_send_error (conn_ent, 400, "Message sending error"); + rspamd_task_free (task); - return; + return; + } + else { + /* Some rules failed and some rules are OK */ + msg_warn_task ("some rules are not processed, but we still sent this request"); + } } else if (!processed) { if (rules) { |