From 28946b7ecf5de3b5817f8ec85981bd8d28dfe41d Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Thu, 10 Sep 2015 16:01:51 +0100 Subject: [PATCH] Fix index calculation. --- src/libserver/html.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libserver/html.c b/src/libserver/html.c index 96380a3ef..e68c73c8c 100644 --- a/src/libserver/html.c +++ b/src/libserver/html.c @@ -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; -- 2.39.5