]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Fix processing of closed tags
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 22 Aug 2017 07:00:47 +0000 (08:00 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 22 Aug 2017 07:00:47 +0000 (08:00 +0100)
src/libserver/html.c

index 2d57f0b0d4fa9790a014770f4613abc899d2bf71..7484f44e849dfb3874c1b9985faf7c53ade7db30 100644 (file)
@@ -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;
                }