aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-01-31 15:53:25 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-01-31 15:53:25 +0100
commit739d63244f84347633bb243955f094dcec4b0ab1 (patch)
treed37ee03c8606052f74932794c2e522f454e3f225
parent9800118df8fce5931589ee2597a0e11e1e70aa8f (diff)
downloadrspamd-739d63244f84347633bb243955f094dcec4b0ab1.tar.gz
rspamd-739d63244f84347633bb243955f094dcec4b0ab1.zip
Fix parsing of ip:port strings
-rw-r--r--src/libutil/addr.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libutil/addr.c b/src/libutil/addr.c
index 2324096e9..7c7eac3a5 100644
--- a/src/libutil/addr.c
+++ b/src/libutil/addr.c
@@ -597,7 +597,9 @@ rspamd_parse_inet_address (rspamd_inet_addr_t **target,
if ((end = memchr (src, ':', srclen)) != NULL) {
/* This is either port number and ipv4 addr or ipv6 addr */
- if (ipv6_status == RSPAMD_IPV6_SUPPORTED &&
+ /* Search for another semicolon */
+ if (memchr (end + 1, ':', srclen - (end - src + 1)) &&
+ ipv6_status == RSPAMD_IPV6_SUPPORTED &&
rspamd_parse_inet_address_ip6 (src, srclen, &su.s6.sin6_addr)) {
addr = rspamd_inet_addr_create (AF_INET6);
memcpy (&addr->u.in.addr.s6.sin6_addr, &su.s6.sin6_addr,