[Asterisk-code-review] res pjsip transport websocket: Give transport semi-meaningfu... (asterisk[master])

Sean Bright asteriskteam at digium.com
Thu Nov 16 16:20:46 CST 2017


Sean Bright has uploaded this change for review. ( https://gerrit.asterisk.org/7247


Change subject: res_pjsip_transport_websocket: Give transport semi-meaningful name
......................................................................

res_pjsip_transport_websocket: Give transport semi-meaningful name

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, 3 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/47/7247/1

diff --git a/res/res_pjsip_transport_websocket.c b/res/res_pjsip_transport_websocket.c
index b5b6a3e..b4ae41b 100644
--- a/res/res_pjsip_transport_websocket.c
+++ b/res/res_pjsip_transport_websocket.c
@@ -218,7 +218,9 @@
 	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.info = (char *) pj_pool_alloc(newtransport->transport.pool,
+			strlen(newtransport->transport.obj_name) + 1);
+	strcpy(newtransport->transport.info, newtransport->transport.obj_name);
 
 	newtransport->transport.dir = PJSIP_TP_DIR_INCOMING;
 	newtransport->transport.tpmgr = tpmgr;

-- 
To view, visit https://gerrit.asterisk.org/7247
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I63d96ef8f7516ac02a0f91e22dfa8acdc615042c
Gerrit-Change-Number: 7247
Gerrit-PatchSet: 1
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20171116/d1df7c07/attachment.html>


More information about the asterisk-code-review mailing list