[Asterisk-code-review] res pjsip transport websocket: Give transport a meaningful d... (asterisk[master])
Jenkins2
asteriskteam at digium.com
Fri Nov 17 06:26:35 CST 2017
Jenkins2 has submitted this change and it was merged. ( https://gerrit.asterisk.org/7247 )
Change subject: res_pjsip_transport_websocket: Give transport a meaningful description
......................................................................
res_pjsip_transport_websocket: Give transport a meaningful description
We were not \0 terminating this string, so any attempt to print it would
in the best case show an empty string and in the worst case potentially
crash.
Change-Id: I63d96ef8f7516ac02a0f91e22dfa8acdc615042c
---
M res/res_pjsip_transport_websocket.c
1 file changed, 4 insertions(+), 2 deletions(-)
Approvals:
Richard Mudgett: Looks good to me, but someone else must approve
Joshua Colp: Looks good to me, approved
Jenkins2: Approved for Submit
diff --git a/res/res_pjsip_transport_websocket.c b/res/res_pjsip_transport_websocket.c
index b5b6a3e..3ce9039 100644
--- a/res/res_pjsip_transport_websocket.c
+++ b/res/res_pjsip_transport_websocket.c
@@ -203,6 +203,10 @@
ast_debug(4, "Creating websocket transport for %s:%s\n",
newtransport->transport.type_name, ws_addr_str);
+ newtransport->transport.info = (char *) pj_pool_alloc(newtransport->transport.pool,
+ strlen(newtransport->transport.type_name) + strlen(ws_addr_str) + sizeof(" to "));
+ sprintf(newtransport->transport.info, "%s to %s", newtransport->transport.type_name, ws_addr_str);
+
pj_sockaddr_parse(pj_AF_UNSPEC(), 0, pj_cstr(&buf, ws_addr_str), &newtransport->transport.key.rem_addr);
if (newtransport->transport.key.rem_addr.addr.sa_family == pj_AF_INET6()) {
newtransport->transport.key.type = transport_type_wss_ipv6;
@@ -218,8 +222,6 @@
newtransport->transport.local_name.port = ast_sockaddr_port(ast_websocket_local_address(newtransport->ws_session));
newtransport->transport.flag = pjsip_transport_get_flag_from_type((pjsip_transport_type_e)newtransport->transport.key.type);
- newtransport->transport.info = (char *)pj_pool_alloc(newtransport->transport.pool, 64);
-
newtransport->transport.dir = PJSIP_TP_DIR_INCOMING;
newtransport->transport.tpmgr = tpmgr;
newtransport->transport.send_msg = &ws_send_msg;
--
To view, visit https://gerrit.asterisk.org/7247
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I63d96ef8f7516ac02a0f91e22dfa8acdc615042c
Gerrit-Change-Number: 7247
Gerrit-PatchSet: 2
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20171117/04053d0b/attachment.html>
More information about the asterisk-code-review
mailing list