Module: kamailio
Branch: master
Commit: 0bbcbe8328d558a9bf3cb151ab53be93b09c2669
URL:
https://github.com/kamailio/kamailio/commit/0bbcbe8328d558a9bf3cb151ab53be9…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2014-12-22T21:40:52+01:00
nat_traversal: use local variable for port and proto on keepalive resolve
- safe execution for those resolving functions expecting PROTO_NONE
- reported by Jason Penton, FS#491
---
Modified: modules/nat_traversal/nat_traversal.c
---
Diff:
https://github.com/kamailio/kamailio/commit/0bbcbe8328d558a9bf3cb151ab53be9…
Patch:
https://github.com/kamailio/kamailio/commit/0bbcbe8328d558a9bf3cb151ab53be9…
---
diff --git a/modules/nat_traversal/nat_traversal.c
b/modules/nat_traversal/nat_traversal.c
index 2f0ffbe..87aaf50 100644
--- a/modules/nat_traversal/nat_traversal.c
+++ b/modules/nat_traversal/nat_traversal.c
@@ -1510,6 +1510,8 @@ send_keepalive(NAT_Contact *contact)
struct dest_info dst;
int nat_port, len;
str nat_ip;
+ unsigned short lport;
+ char lproto;
if (keepalive_params.from == NULL) {
if (contact->socket != last_socket) {
@@ -1554,7 +1556,9 @@ send_keepalive(NAT_Contact *contact)
ptr = strchr(nat_ip.s, ':');
nat_ip.len = ptr - nat_ip.s;
nat_port = strtol(ptr+1, NULL, 10);
- hostent = sip_resolvehost(&nat_ip, NULL, NULL);
+ lport = 0;
+ lproto = PROTO_NONE;
+ hostent = sip_resolvehost(&nat_ip, &lport, &lproto);
hostent2su(&dst.to, hostent, 0, nat_port);
dst.proto=PROTO_UDP;
dst.send_sock=contact->socket;