Module: kamailio
Branch: 4.3
Commit: 160ec06e7d7e3f8c46fdc62132c46fd695119572
URL: 
https://github.com/kamailio/kamailio/commit/160ec06e7d7e3f8c46fdc62132c46fd695119572

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2016-02-05T09:24:29+01:00

corex: fix regression introduced with detection of ipv6 for send()

- reported by Paul Arnold, GH #496

(cherry picked from commit 8e20a3c5cf3036b203cda629d89659fb1c57c53b)

---

Modified: modules/corex/corex_lib.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/160ec06e7d7e3f8c46fdc62132c46fd695119572.diff
Patch: 
https://github.com/kamailio/kamailio/commit/160ec06e7d7e3f8c46fdc62132c46fd695119572.patch

---

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;


_______________________________________________
sr-dev mailing list
[email protected]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to