res_pjsip_nat.c: Create deep copies of strings when appropriate

In rewrite_uri asterisk was not making deep copies of strings when
changing the uri. This was in some cases causing garbage in the route
header and in other cases even crashing asterisk when receiving a
message with a record-route header set. Thanks to Ralf Kubis for
pointing out why this happens. A similar problem was found in
res_pjsip_transport_websocket.c. Pjproject needs as well to be patched
to avoid garbage in CANCEL messages.

ASTERISK-29024 #close

Change-Id: Ic5acd7fa2fbda3080f5f36ef12e46804939b198b
This commit is contained in:
Pirmin Walthert
2020-12-08 18:37:13 +01:00
committed by George Joseph
parent ccb4951bf8
commit 7a6cfde4db
3 changed files with 43 additions and 6 deletions

View File

@@ -454,7 +454,7 @@ static pj_bool_t websocket_on_rx_msg(pjsip_rx_data *rdata)
pj_strbuf(txp_str));
}
pj_cstr(&uri->host, rdata->pkt_info.src_name);
pj_strdup2(rdata->tp_info.pool, &uri->host, rdata->pkt_info.src_name);
uri->port = rdata->pkt_info.src_port;
pj_strdup(rdata->tp_info.pool, &uri->transport_param, txp_str);
}