From: Vsevolod Stakhov Date: Mon, 9 Feb 2015 17:28:32 +0000 (+0000) Subject: Fix race condition. X-Git-Tag: 0.9.0~732 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=3223f408df78031f651c76109b48a5bc8fbd93dd;p=rspamd.git Fix race condition. This race condition could occur if a message has too high spam score and the planner decides to stop checking. However, already registered events pending were not checked, which caused use-after-free for a task object. --- diff --git a/src/libmime/filter.c b/src/libmime/filter.c index 99e888730..89bbfad10 100644 --- a/src/libmime/filter.c +++ b/src/libmime/filter.c @@ -381,7 +381,9 @@ rspamd_process_filters (struct rspamd_task *task) if (!task->pass_all_filters && metric->actions[METRIC_ACTION_REJECT].score > 0 && check_metric_is_spam (task, metric)) { - task->state = WRITE_REPLY; + msg_info ("<%s> has already scored more than %.2f, so do not " + "plan any more checks", task->message_id, + metric->actions[METRIC_ACTION_REJECT].score); return 1; } cur = g_list_next (cur);