From f0a395c9c90f7672979f7963627cdd23b0e04e36 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Fri, 5 Aug 2016 12:15:31 +0100 Subject: [PATCH] [Fix] Some more changes to tag's content length calculations --- src/libserver/html.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/libserver/html.c b/src/libserver/html.c index f897acd8e..d39816f87 100644 --- a/src/libserver/html.c +++ b/src/libserver/html.c @@ -1833,6 +1833,13 @@ rspamd_html_process_part_full (rspamd_mempool_t *pool, struct html_content *hc, } g_byte_array_append (dest, c, len); + if (content_tag) { + if (content_tag->content == NULL) { + content_tag->content = c; + } + + content_tag->content_length += p - c + 1; + } } c = p; @@ -1863,12 +1870,16 @@ rspamd_html_process_part_full (rspamd_mempool_t *pool, struct html_content *hc, g_byte_array_append (dest, c, len); if (content_tag) { - content_tag->content_length = len; - content_tag->content = c; - content_tag = NULL; + if (content_tag->content == NULL) { + content_tag->content = c; + } + + content_tag->content_length += p - c; } } + content_tag = NULL; + state = tag_begin; continue; } @@ -1883,6 +1894,10 @@ rspamd_html_process_part_full (rspamd_mempool_t *pool, struct html_content *hc, continue; } + if (content_tag) { + content_tag->content_length ++; + } + p ++; break; -- 2.39.5