Module: kamailio
Branch: master
Commit: 8e20a3c5cf3036b203cda629d89659fb1c57c53b
URL:
https://github.com/kamailio/kamailio/commit/8e20a3c5cf3036b203cda629d89659f…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2016-02-05T09:21:25+01:00
corex: fix regression introduced with detection of ipv6 for send()
- reported by Paul Arnold, GH #496
---
Modified: modules/corex/corex_lib.c
---
Diff:
https://github.com/kamailio/kamailio/commit/8e20a3c5cf3036b203cda629d89659f…
Patch:
https://github.com/kamailio/kamailio/commit/8e20a3c5cf3036b203cda629d89659f…
---
diff --git a/modules/corex/corex_lib.c b/modules/corex/corex_lib.c
index 21593f5..9e1c521 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;