Module: kamailio
Branch: master
Commit: a886f8ef15677b951e36407735f1fb5b94f0edd0
URL:
https://github.com/kamailio/kamailio/commit/a886f8ef15677b951e36407735f1fb5…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2019-10-01T10:28:43+02:00
core: tcp - safety check that dst address is provided for tcp_send()
---
Modified: src/core/tcp_main.c
---
Diff:
https://github.com/kamailio/kamailio/commit/a886f8ef15677b951e36407735f1fb5…
Patch:
https://github.com/kamailio/kamailio/commit/a886f8ef15677b951e36407735f1fb5…
---
diff --git a/src/core/tcp_main.c b/src/core/tcp_main.c
index 61a692af85..99d33ee719 100644
--- a/src/core/tcp_main.c
+++ b/src/core/tcp_main.c
@@ -2002,8 +2002,13 @@ int tcp_send(struct dest_info* dst, union sockaddr_union* from,
snd_flags_t t_send_flags;
#endif /* USE_TLS */
+ if(unlikely(dst==NULL)) {
+ LM_ERR("no destination address provided\n");
+ return -1;
+ }
+
port=su_getport(&dst->to);
- try_local_port = (dst && dst->send_sock)?dst->send_sock->port_no:0;
+ try_local_port = (dst->send_sock)?dst->send_sock->port_no:0;
con_lifetime=cfg_get(tcp, tcp_cfg, con_lifetime);
if (likely(port)){
su2ip_addr(&ip, &dst->to);