summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/libmime/message.c7
-rw-r--r--src/ragel/newlines_strip.rl2
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;
}