]> source.dussan.org Git - rspamd.git/commitdiff
Fix critical bug in recipients_distance function.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 18 Aug 2014 13:59:46 +0000 (14:59 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 18 Aug 2014 13:59:46 +0000 (14:59 +0100)
src/libmime/expressions.c

index cce1209aa7718e5761599b41e182c7819f7a4608..0289daa5790df06c210fdad6235fd94e9d47d9cc 100644 (file)
@@ -1259,10 +1259,10 @@ rspamd_recipients_distance (struct rspamd_task *task, GList * args,
                return FALSE;
        }
 
-       if (!task->rcpts) {
+       if (!task->rcpt_mime) {
                return FALSE;
        }
-       num = internet_address_list_length (task->rcpts);
+       num = internet_address_list_length (task->rcpt_mime);
        if (num < MIN_RCPT_TO_COMPARE) {
                return FALSE;
        }
@@ -1271,14 +1271,13 @@ rspamd_recipients_distance (struct rspamd_task *task, GList * args,
                        sizeof (struct addr_list));
 
        /* Fill array */
-       cur = task->rcpts;
+       cur = task->rcpt_mime;
 #ifdef GMIME24
        for (i = 0; i < num; i++) {
                addr = internet_address_list_get_address (cur, i);
-               ar[i].name = rspamd_mempool_strdup (task->task_pool,
-                               internet_address_get_name (addr));
+               ar[i].name = internet_address_mailbox_get_addr (
+                               INTERNET_ADDRESS_MAILBOX (addr));
                if (ar[i].name != NULL && (c = strchr (ar[i].name, '@')) != NULL) {
-                       *c = '\0';
                        ar[i].addr = c + 1;
                }
        }