Module: kamailio
Branch: 4.2
Commit: f9d55664519e8753dfff1f1a824d207176b04252
URL:
https://github.com/kamailio/kamailio/commit/f9d55664519e8753dfff1f1a824d207…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2016-02-05T09:25:19+01:00
corex: fix regression introduced with detection of ipv6 for send()
- reported by Paul Arnold, GH #496
(cherry picked from commit 8e20a3c5cf3036b203cda629d89659fb1c57c53b)
(cherry picked from commit 160ec06e7d7e3f8c46fdc62132c46fd695119572)
---
Modified: modules/corex/corex_lib.c
---
Diff:
https://github.com/kamailio/kamailio/commit/f9d55664519e8753dfff1f1a824d207…
Patch:
https://github.com/kamailio/kamailio/commit/f9d55664519e8753dfff1f1a824d207…
---
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;