commit bf2280a: [Minor] Allow braced and prefixed IPv6 addresses

Vsevolod Stakhov vsevolod at highsecure.ru
Sun Jun 9 08:56:03 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-06-09 09:51:42 +0100
URL: https://github.com/rspamd/rspamd/commit/bf2280a995cbc4286a5de245a3304251fead8c1a

[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++;


More information about the Commits mailing list