aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-02-07 17:21:03 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-02-07 17:21:03 +0000
commit1e0caa55d3f1910973694d6481a13c689212a1cd (patch)
tree3bdeb3a53ffbda05aa4a814e7915d80dfe8d82a5
parentc5e2e9babb03058cb94320a6e1fe7002c247fb5a (diff)
downloadrspamd-1e0caa55d3f1910973694d6481a13c689212a1cd.tar.gz
rspamd-1e0caa55d3f1910973694d6481a13c689212a1cd.zip
[Minor] Another try to fix 'IPv6:' prefix
-rw-r--r--src/libutil/addr.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/libutil/addr.c b/src/libutil/addr.c
index 022a94559..fd4621aef 100644
--- a/src/libutil/addr.c
+++ b/src/libutil/addr.c
@@ -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,