From bf2280a995cbc4286a5de245a3304251fead8c1a Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Sun, 9 Jun 2019 09:51:42 +0100 Subject: [PATCH] [Minor] Allow braced and prefixed IPv6 addresses --- src/libutil/addr.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/libutil/addr.c b/src/libutil/addr.c index 4babfb1d2..30a9ce66a 100644 --- a/src/libutil/addr.c +++ b/src/libutil/addr.c @@ -527,6 +527,12 @@ rspamd_parse_inet_address_ip6 (const guchar *text, gsize len, gpointer target) len -= sizeof ("IPv6:") - 1; } + if (*p == '[' && len > 1 && p[len - 1] == ']') { + /* Strip [] as well */ + p ++; + len -= 2; + } + /* Ignore leading colon */ if (len > 0 && *p == ':') { p++; -- 2.39.5