diff options
-rw-r--r-- | src/expressions.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/expressions.c b/src/expressions.c index 0d61f9ca2..c009ddc84 100644 --- a/src/expressions.c +++ b/src/expressions.c @@ -1265,13 +1265,18 @@ rspamd_recipients_distance (struct worker_task *task, GList * args, void *unused i = 0; while (cur) { addr = internet_address_list_get_address (cur); - ar[i].name = memory_pool_strdup (task->task_pool, internet_address_get_addr (addr)); - if (ar[i].name != NULL && (c = strchr (ar[i].name, '@')) != NULL) { - *c = '\0'; - ar[i].addr = c + 1; + if (addr && internet_address_get_type (addr) == INTERNET_ADDRESS_NAME) { + ar[i].name = memory_pool_strdup (task->task_pool, internet_address_get_addr (addr)); + if (ar[i].name != NULL && (c = strchr (ar[i].name, '@')) != NULL) { + *c = '\0'; + ar[i].addr = c + 1; + } + cur = internet_address_list_next (cur); + i++; + } + else { + cur = internet_address_list_next (cur); } - cur = internet_address_list_next (cur); - i++; } #endif |