commit fc55fd2: [Minor] Fix expressions for empty content HTML parts

Vsevolod Stakhov vsevolod at highsecure.ru
Wed Feb 13 17:07:03 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-02-13 17:04:38 +0000
URL: https://github.com/rspamd/rspamd/commit/fc55fd21a5b3c7c3c31d24f0037f417fc83058c7 (HEAD -> master)

[Minor] Fix expressions for empty content HTML parts
Issue: #2751

---
 src/libmime/mime_expressions.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/libmime/mime_expressions.c b/src/libmime/mime_expressions.c
index bdc6e46f5..d45dafe5c 100644
--- a/src/libmime/mime_expressions.c
+++ b/src/libmime/mime_expressions.c
@@ -1502,7 +1502,7 @@ rspamd_is_html_balanced (struct rspamd_task * task, GArray * args, void *unused)
 	for (i = 0; i < task->text_parts->len; i ++) {
 
 		p = g_ptr_array_index (task->text_parts, i);
-		if (!IS_PART_EMPTY (p) && IS_PART_HTML (p)) {
+		if (IS_PART_HTML (p)) {
 			if (p->flags & RSPAMD_MIME_TEXT_PART_FLAG_BALANCED) {
 				res = TRUE;
 			}
@@ -1539,7 +1539,7 @@ rspamd_has_html_tag (struct rspamd_task * task, GArray * args, void *unused)
 	for (i = 0; i < task->text_parts->len; i ++) {
 		p = g_ptr_array_index (task->text_parts, i);
 
-		if (!IS_PART_EMPTY (p) && IS_PART_HTML (p) && p->html) {
+		if (IS_PART_HTML (p) && p->html) {
 			res = rspamd_html_tag_seen (p->html, arg->data);
 		}
 
@@ -1562,7 +1562,7 @@ rspamd_has_fake_html (struct rspamd_task * task, GArray * args, void *unused)
 	for (i = 0; i < task->text_parts->len; i ++) {
 		p = g_ptr_array_index (task->text_parts, i);
 
-		if (!IS_PART_EMPTY (p) && IS_PART_HTML (p) && p->html->html_tags == NULL) {
+		if (IS_PART_HTML (p) && (p->html == NULL || p->html->html_tags == NULL)) {
 			res = TRUE;
 		}
 


More information about the Commits mailing list