summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2009-12-22 13:00:22 +0000
committerBenny Prijono <bennylp@teluu.com>2009-12-22 13:00:22 +0000
commite3656f1930f5018c386afdec9ee5bb6f093c59d9 (patch)
tree2a11bb1739f541e9d810a145790d12e888314ecf
parentf64da4846c63db9b4765668fcde09d992d0ed424 (diff)
Misc (#1003): added protection against situation when pj_sock_getsockname() returns PJ_SUCCESS but 0.0.0.0 is reported as the socket address, potentially causing SIP TCP transport to put 0.0.0.0 or empty Via address. Not sure if this situation could happen though.
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@3035 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r--pjsip/src/pjsip/sip_transport_tcp.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/pjsip/src/pjsip/sip_transport_tcp.c b/pjsip/src/pjsip/sip_transport_tcp.c
index 8b89d707..56a4fe8f 100644
--- a/pjsip/src/pjsip/sip_transport_tcp.c
+++ b/pjsip/src/pjsip/sip_transport_tcp.c
@@ -1280,7 +1280,9 @@ static pj_bool_t on_connect_complete(pj_activesock_t *asock,
if (pj_sock_getsockname(tcp->sock, &addr, &addrlen)==PJ_SUCCESS) {
pj_sockaddr_in *tp_addr = (pj_sockaddr_in*)&tcp->base.local_addr;
- if (tp_addr->sin_addr.s_addr != addr.sin_addr.s_addr) {
+ if (pj_sockaddr_has_addr(&addr) &&
+ tp_addr->sin_addr.s_addr != addr.sin_addr.s_addr)
+ {
tp_addr->sin_addr.s_addr = addr.sin_addr.s_addr;
tp_addr->sin_port = addr.sin_port;
sockaddr_to_host_port(tcp->base.pool, &tcp->base.local_name,