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

Sean Bright asteriskteam at digium.com
Thu Nov 16 16:19:41 CST 2017


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


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/45/7245/1

diff --git a/res/res_pjsip_transport_websocket.c b/res/res_pjsip_transport_websocket.c
index b1f560c..e288270 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/7245
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: newchange
Gerrit-Change-Id: I63d96ef8f7516ac02a0f91e22dfa8acdc615042c
Gerrit-Change-Number: 7245
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/4662bc73/attachment.html>


More information about the asterisk-code-review mailing list