From c27e8fb40821a3401b70b789f1efcb28bab5c50a Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Tue, 22 Aug 2017 08:00:47 +0100 Subject: [PATCH] [Fix] Fix processing of closed tags --- src/libserver/html.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/libserver/html.c b/src/libserver/html.c index 2d57f0b0d..7484f44e8 100644 --- a/src/libserver/html.c +++ b/src/libserver/html.c @@ -1009,7 +1009,7 @@ rspamd_html_process_tag (rspamd_mempool_t *pool, struct html_content *hc, /* Block tag */ nnode = g_node_new (tag); - if (tag->flags & FL_CLOSING) { + if (tag->flags & (FL_CLOSING|FL_CLOSED)) { if (!*cur_level) { msg_debug_html ("bad parent node"); g_node_destroy (nnode); @@ -1426,10 +1426,17 @@ rspamd_html_parse_tag_content (rspamd_mempool_t *pool, if (g_ascii_isspace (*in)) { state = spaces_after_param; } + else if (*in == '/' && *(in + 1) == '>') { + tag->flags |= FL_CLOSED; + } break; case spaces_after_param: if (!g_ascii_isspace (*in)) { + if (*in == '/' && *(in + 1) == '>') { + tag->flags |= FL_CLOSED; + } + state = parse_attr_name; *savep = in; } -- 2.39.5