From 2445d1680b3d3a2b5c80deb285e857a0337e44d5 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Wed, 30 Apr 2014 14:33:48 +0100 Subject: [PATCH] Be more accurate about msg->body. --- src/webui.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/webui.c b/src/webui.c index 3c276e3123..3e95476cad 100644 --- a/src/webui.c +++ b/src/webui.c @@ -883,7 +883,7 @@ rspamd_webui_handle_learn_common (struct rspamd_http_connection_entry *conn_ent, return 0; } - if (msg->body->len == 0) { + if (msg->body == NULL || msg->body->len == 0) { msg_err ("got zero length body, cannot continue"); rspamd_webui_send_error (conn_ent, 400, "Empty body is not permitted"); return 0; @@ -973,7 +973,7 @@ rspamd_webui_handle_scan (struct rspamd_http_connection_entry *conn_ent, return 0; } - if (msg->body->len == 0) { + if (msg->body == NULL || msg->body->len == 0) { msg_err ("got zero length body, cannot continue"); rspamd_webui_send_error (conn_ent, 400, "Empty body is not permitted"); return 0; @@ -1030,7 +1030,7 @@ rspamd_webui_handle_saveactions (struct rspamd_http_connection_entry *conn_ent, return 0; } - if (msg->body->len == 0) { + if (msg->body == NULL || msg->body->len == 0) { msg_err ("got zero length body, cannot continue"); rspamd_webui_send_error (conn_ent, 400, "Empty body is not permitted"); return 0; @@ -1124,7 +1124,7 @@ rspamd_webui_handle_savesymbols (struct rspamd_http_connection_entry *conn_ent, return 0; } - if (msg->body->len == 0) { + if (msg->body == NULL || msg->body->len == 0) { msg_err ("got zero length body, cannot continue"); rspamd_webui_send_error (conn_ent, 400, "Empty body is not permitted"); return 0; @@ -1220,7 +1220,7 @@ rspamd_webui_handle_savemap (struct rspamd_http_connection_entry *conn_ent, return 0; } - if (msg->body->len == 0) { + if (msg->body == NULL || msg->body->len == 0) { msg_err ("got zero length body, cannot continue"); rspamd_webui_send_error (conn_ent, 400, "Empty body is not permitted"); return 0; @@ -1527,7 +1527,7 @@ rspamd_webui_handle_custom (struct rspamd_http_connection_entry *conn_ent, if (!rspamd_webui_check_password (conn_ent, session, msg, cmd->privilleged)) { return 0; } - if (cmd->require_message && msg->body->len == 0) { + if (cmd->require_message && (msg->body == NULL || msg->body->len == 0)) { msg_err ("got zero length body, cannot continue"); rspamd_webui_send_error (conn_ent, 400, "Empty body is not permitted"); return 0; -- 2.47.3