]> source.dussan.org Git - rspamd.git/commitdiff
[CritFix] Fix issue with finding of end of lines pointers
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 25 Aug 2016 12:11:31 +0000 (13:11 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 25 Aug 2016 12:11:31 +0000 (13:11 +0100)
src/libmime/message.c
src/ragel/newlines_strip.rl

index e815bdbe48005a1d6cfd4a68247e3dc8332087e6..8f4417db4a84c1563fe3b7f026a06669a2b5bb93 100644 (file)
@@ -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);
index a0e239bc3f0339d46557a48c338d4087f29ed289..d5de198a529fbd47bbd1e511146a9d4387926143 100644 (file)
@@ -40,7 +40,7 @@
     }
 
     (*newlines_count)++;
-    g_ptr_array_add (newlines, (gpointer)p);
+    g_ptr_array_add (newlines, (((gpointer) (goffset) (data->len))));
     c = p;
   }