Skip to content
Snippets Groups Projects
Commit 7a735d45 authored by Sean Bright's avatar Sean Bright
Browse files

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
parent ccbf176c
No related branches found
No related tags found
No related merge requests found
......@@ -203,6 +203,10 @@ static int transport_create(void *data)
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 @@ static int transport_create(void *data)
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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment