From: Vsevolod Stakhov Date: Fri, 5 Aug 2016 11:15:31 +0000 (+0100) Subject: [Fix] Some more changes to tag's content length calculations X-Git-Tag: 1.3.2~35 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=f0a395c9c90f7672979f7963627cdd23b0e04e36;p=rspamd.git [Fix] Some more changes to tag's content length calculations --- 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;