diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-08-25 13:11:31 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-08-25 13:11:31 +0100 |
commit | 1624cdd029f4865dcd90e876b0c4968fa9c6bb40 (patch) | |
tree | 740f2ae699dab3b6460af6808ee34609e0709e7f /src | |
parent | 23f831e0c58959e22c24ecd2bbd21a8a91183823 (diff) | |
download | rspamd-1624cdd029f4865dcd90e876b0c4968fa9c6bb40.tar.gz rspamd-1624cdd029f4865dcd90e876b0c4968fa9c6bb40.zip |
[CritFix] Fix issue with finding of end of lines pointers
Diffstat (limited to 'src')
-rw-r--r-- | src/libmime/message.c | 7 | ||||
-rw-r--r-- | src/ragel/newlines_strip.rl | 2 |
2 files changed, 6 insertions, 3 deletions
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; } |