From: Vsevolod Stakhov Date: Mon, 21 Apr 2014 13:55:50 +0000 (+0100) Subject: Fix spf module for inet_addr. X-Git-Tag: 0.7.0~309 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b9a379e9d6b05b0f558ad052389fdb5384b189a8;p=thirdparty%2Frspamd.git Fix spf module for inet_addr. --- diff --git a/src/spf.c b/src/spf.c index 2219a5b8f7..12f1513d49 100644 --- a/src/spf.c +++ b/src/spf.c @@ -1019,13 +1019,9 @@ expand_spf_macro (struct rspamd_task *task, struct spf_record *rec, gchar *begin switch (g_ascii_tolower (*p)) { case 'i': #ifdef HAVE_INET_PTON - if (task->from_addr.ipv6) { - inet_ntop (AF_INET6, &task->from_addr.d.in6, ip_buf, sizeof (ip_buf)); - } - else { - inet_ntop (AF_INET, &task->from_addr.d.in4, ip_buf, sizeof (ip_buf)); - } - len = strlen (ip_buf); + len = rspamd_strlcpy (ip_buf, + rspamd_inet_address_to_string (&task->from_addr), + sizeof (ip_buf)); memcpy (c, ip_buf, len); #else tmp = inet_ntoa (task->from_addr);