]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Some more changes to tag's content length calculations
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 5 Aug 2016 11:15:31 +0000 (12:15 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 5 Aug 2016 12:05:45 +0000 (13:05 +0100)
src/libserver/html.c

index f897acd8e9471b0123cb9895fa42561a20c86bb6..d39816f873fbf48563cc1d47185cb0f101948d66 100644 (file)
@@ -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;