From: Vsevolod Stakhov Date: Thu, 25 Aug 2016 12:11:31 +0000 (+0100) Subject: [CritFix] Fix issue with finding of end of lines pointers X-Git-Tag: 1.4.0~562 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=1624cdd029f4865dcd90e876b0c4968fa9c6bb40;p=rspamd.git [CritFix] Fix issue with finding of end of lines pointers --- diff --git a/src/libmime/message.c b/src/libmime/message.c index e815bdbe4..8f4417db4 100644 --- a/src/libmime/message.c +++ b/src/libmime/message.c @@ -785,6 +785,7 @@ rspamd_normalize_text_part (struct rspamd_task *task, const guchar *p, *c, *end; guint i; + goffset off; struct rspamd_process_exception *ex; /* Strip newlines */ @@ -799,8 +800,10 @@ rspamd_normalize_text_part (struct rspamd_task *task, for (i = 0; i < part->newlines->len; i ++) { ex = rspamd_mempool_alloc (task->task_pool, sizeof (*ex)); - p = g_ptr_array_index (part->newlines, i); - ex->pos = p - c; + off = (goffset)g_ptr_array_index (part->newlines, i); + g_ptr_array_index (part->newlines, i) = (gpointer)(goffset) + (part->stripped_content->data + off); + ex->pos = off; ex->len = 0; ex->type = RSPAMD_EXCEPTION_NEWLINE; part->exceptions = g_list_prepend (part->exceptions, ex); diff --git a/src/ragel/newlines_strip.rl b/src/ragel/newlines_strip.rl index a0e239bc3..d5de198a5 100644 --- a/src/ragel/newlines_strip.rl +++ b/src/ragel/newlines_strip.rl @@ -40,7 +40,7 @@ } (*newlines_count)++; - g_ptr_array_add (newlines, (gpointer)p); + g_ptr_array_add (newlines, (((gpointer) (goffset) (data->len)))); c = p; }