}
if (src[0] == '[') {
+ const gchar *ip_start;
/* Ipv6 address in format [::1]:port or just [::1] */
end = memchr (src + 1, ']', srclen - 1);
return FALSE;
}
- rspamd_strlcpy (ipbuf, src + 1, iplen + 1);
+ if (iplen > sizeof ("IPv6:") - 1 &&
+ g_ascii_strncasecmp (src + 1, "IPv6:", sizeof ("IPv6:") - 1) == 0) {
+ /* Special case, SMTP conformant IPv6 address */
+ ip_start = src + 1 + sizeof ("IPv6:") - 1;
+ iplen -= sizeof ("IPv6:") - 1;
+ }
+ else {
+ ip_start = src + 1;
+ }
+
+ rspamd_strlcpy (ipbuf, ip_start, iplen + 1);
if (rspamd_parse_inet_address_ip6 (ipbuf, iplen,
&su.s6.sin6_addr)) {