Browse Source

[Minor] Another try to fix 'IPv6:' prefix

tags/1.9.0
Vsevolod Stakhov 5 years ago
parent
commit
1e0caa55d3
1 changed files with 8 additions and 10 deletions
  1. 8
    10
      src/libutil/addr.c

+ 8
- 10
src/libutil/addr.c View File

@@ -528,6 +528,13 @@ rspamd_parse_inet_address_ip6 (const guchar *text, gsize len, gpointer target)
len = percent - p; /* Ignore scope */
}

if (len > sizeof ("IPv6:") - 1 &&
g_ascii_strncasecmp (p, "IPv6:", sizeof ("IPv6:") - 1) == 0) {
/* Special case, SMTP conformant IPv6 address */
p += sizeof ("IPv6:") - 1;
len -= sizeof ("IPv6:") - 1;
}

for (/* void */; len; len--) {
t = *p++;

@@ -735,16 +742,7 @@ rspamd_parse_inet_address_common (rspamd_inet_addr_t **target,
return FALSE;
}

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;
}

ip_start = src + 1;
rspamd_strlcpy (ipbuf, ip_start, iplen + 1);

if (rspamd_parse_inet_address_ip6 (ipbuf, iplen,

Loading…
Cancel
Save