diff options
author | Vsevolod Stakhov <vsevolod@rspamd.com> | 2024-08-18 01:25:53 +0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-17 20:25:53 +0100 |
commit | 8fe1612bdb6572fc60284190351ed4075d72402a (patch) | |
tree | 53e8e1020764d4526334e06372cf2beb8d899be2 /src/controller.c | |
parent | 1e661a2fc6e31aa0c5be710dde274ec199ff3853 (diff) | |
download | rspamd-8fe1612bdb6572fc60284190351ed4075d72402a.tar.gz rspamd-8fe1612bdb6572fc60284190351ed4075d72402a.zip |
Fix issue with broken HTTP message to learn endpoints (#5106)
* [Fix] Check message before trying to dereference pointer
Issue: #5089
* [Minor] Fix stripping of the last characters
Diffstat (limited to 'src/controller.c')
-rw-r--r-- | src/controller.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/controller.c b/src/controller.c index d91f99098..386448f93 100644 --- a/src/controller.c +++ b/src/controller.c @@ -1945,7 +1945,7 @@ rspamd_controller_learn_fin_task(void *ud) if (task->err != NULL) { msg_info_session("cannot learn <%s>: %e", - MESSAGE_FIELD(task, message_id), task->err); + MESSAGE_FIELD_CHECK(task, message_id), task->err); rspamd_controller_send_error(conn_ent, task->err->code, "%s", task->err->message); @@ -1957,14 +1957,14 @@ rspamd_controller_learn_fin_task(void *ud) msg_info_task("<%s> learned message as %s: %s", rspamd_inet_address_to_string(session->from_addr), session->is_spam ? "spam" : "ham", - MESSAGE_FIELD(task, message_id)); + MESSAGE_FIELD_CHECK(task, message_id)); rspamd_controller_send_string(conn_ent, "{\"success\":true}"); return TRUE; } if (!rspamd_task_process(task, RSPAMD_TASK_PROCESS_LEARN)) { msg_info_task("cannot learn <%s>: %e", - MESSAGE_FIELD(task, message_id), task->err); + MESSAGE_FIELD_CHECK(task, message_id), task->err); if (task->err) { rspamd_controller_send_error(conn_ent, task->err->code, "%s", @@ -1985,7 +1985,7 @@ rspamd_controller_learn_fin_task(void *ud) msg_info_task("<%s> learned message as %s: %s", rspamd_inet_address_to_string(session->from_addr), session->is_spam ? "spam" : "ham", - MESSAGE_FIELD(task, message_id)); + MESSAGE_FIELD_CHECK(task, message_id)); rspamd_controller_send_string(conn_ent, "{\"success\":true}"); } @@ -2114,7 +2114,7 @@ rspamd_controller_handle_learn_common( if (!rspamd_task_process(task, RSPAMD_TASK_PROCESS_LEARN)) { msg_warn_session("<%s> message cannot be processed", - MESSAGE_FIELD(task, message_id)); + MESSAGE_FIELD_CHECK(task, message_id)); goto end; } |