From 8e20a3c5cf3036b203cda629d89659fb1c57c53b Mon Sep 17 00:00:00 2001 From: Daniel-Constantin Mierla Date: Fri, 5 Feb 2016 09:18:48 +0100 Subject: [PATCH] corex: fix regression introduced with detection of ipv6 for send() - reported by Paul Arnold, GH #496 --- modules/corex/corex_lib.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/modules/corex/corex_lib.c b/modules/corex/corex_lib.c index 21593f55bf0..9e1c521e480 100644 --- a/modules/corex/corex_lib.c +++ b/modules/corex/corex_lib.c @@ -258,11 +258,14 @@ int corex_send(sip_msg_t *msg, gparam_t *pu, enum sip_protos proto) u = &next_hop; u->port_no = 5060; u->host = dest; - p = dest.s; /* detect ipv6 */ - p = memchr(p, ']', dest.len); - if (p) p++; - p = memchr(p, ':', dest.len); + p = memchr(dest.s, ']', dest.len); + if (p) { + p++; + p = memchr(p, ':', dest.s + dest.len - p); + } else { + p = memchr(dest.s, ':', dest.len); + } if (p) { u->host.len = p - dest.s;