aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-06-09 09:35:55 +0100
committerGitHub <noreply@github.com>2019-06-09 09:35:55 +0100
commit4f0df8d95afab67fc8bbfdcf21d37226d6e4eb0e (patch)
tree2aedb24340b1d89b3adf9fbe50ffefb8bacec87d /src
parenta55b88e68ee8c888e46a9640978f3e71f442ac86 (diff)
parente68ea4ea38376ba0eedf36578c3499159e675c90 (diff)
downloadrspamd-4f0df8d95afab67fc8bbfdcf21d37226d6e4eb0e.tar.gz
rspamd-4f0df8d95afab67fc8bbfdcf21d37226d6e4eb0e.zip
Merge pull request #2915 from gollux/master
libutil: Fix parsing of address "IPv6:::1"
Diffstat (limited to 'src')
-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 7fa634f6f..4babfb1d2 100644
--- a/src/libutil/addr.c
+++ b/src/libutil/addr.c
@@ -510,19 +510,11 @@ rspamd_parse_inet_address_ip6 (const guchar *text, gsize len, gpointer target)
g_assert (text != NULL);
g_assert (target != NULL);
+ p = text;
if (len == 0) {
len = strlen (text);
}
- /* Ignore trailing semicolon */
- if (text[0] == ':') {
- p = text + 1;
- len--;
- }
- else {
- p = text;
- }
-
/* Check IPv6 scope */
if ((percent = memchr (p, '%', len)) != NULL && percent > p) {
len = percent - p; /* Ignore scope */
@@ -535,6 +527,12 @@ rspamd_parse_inet_address_ip6 (const guchar *text, gsize len, gpointer target)
len -= sizeof ("IPv6:") - 1;
}
+ /* Ignore leading colon */
+ if (len > 0 && *p == ':') {
+ p++;
+ len--;
+ }
+
for (/* void */; len; len--) {
t = *p++;
@@ -580,7 +578,7 @@ rspamd_parse_inet_address_ip6 (const guchar *text, gsize len, gpointer target)
}
if (++nibbles > 4) {
- /* Too many dots */
+ /* Too many digits */
return FALSE;
}