]> source.dussan.org Git - rspamd.git/commitdiff
Fix index calculation.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 10 Sep 2015 15:01:51 +0000 (16:01 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 10 Sep 2015 15:01:51 +0000 (16:01 +0100)
src/libserver/html.c

index 96380a3ef6ec3e3928362871c103b5881960a21b..e68c73c8ccef09b573c65f6804619c0b91b498c6 100644 (file)
@@ -1892,7 +1892,7 @@ rspamd_html_process_part_full (rspamd_mempool_t *pool, struct html_content *hc,
                                                cur_tag->id == Tag_HR || cur_tag->id == Tag_TR ||
                                                cur_tag->id == Tag_DIV) && balanced) {
                                        /* Insert newline */
-                                       if (dest->data[dest->len - 1] != '\n') {
+                                       if (dest->len > 0 && dest->data[dest->len - 1] != '\n') {
                                                g_byte_array_append (dest, "\r\n", 2);
                                        }
                                        save_space = FALSE;