[sr-dev] git:master:8e20a3c5: corex: fix regression introduced with detection of ipv6 for send()

Daniel-Constantin Mierla miconda at gmail.com
Fri Feb 5 09:21:40 CET 2016


Module: kamailio
Branch: master
Commit: 8e20a3c5cf3036b203cda629d89659fb1c57c53b
URL: https://github.com/kamailio/kamailio/commit/8e20a3c5cf3036b203cda629d89659fb1c57c53b

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at 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/8e20a3c5cf3036b203cda629d89659fb1c57c53b.diff
Patch: https://github.com/kamailio/kamailio/commit/8e20a3c5cf3036b203cda629d89659fb1c57c53b.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;




More information about the sr-dev mailing list