mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-05 04:11:08 +00:00
res/res_pjsip_diversion: prevent crash on tel: uri in History-Info
Add a check to see if the URI is a Tel URI and prevent crashing on trying to retrieve the reason parameter. ASTERISK-29191 ASTERISK-29219 Change-Id: I0320aa205f22cda511d60a2edf2b037e8fd6cc37
This commit is contained in:
committed by
George Joseph
parent
b240b84331
commit
354049e055
@@ -314,8 +314,14 @@ static void set_redirecting_reason_by_cause(pjsip_name_addr *name_addr,
|
|||||||
{
|
{
|
||||||
static const pj_str_t cause_name = { "cause", 5 };
|
static const pj_str_t cause_name = { "cause", 5 };
|
||||||
pjsip_sip_uri *uri = pjsip_uri_get_uri(name_addr);
|
pjsip_sip_uri *uri = pjsip_uri_get_uri(name_addr);
|
||||||
pjsip_param *cause = pjsip_param_find(&uri->other_param, &cause_name);
|
pjsip_param *cause = NULL;
|
||||||
unsigned long cause_value;
|
unsigned long cause_value = 0;
|
||||||
|
|
||||||
|
if (!PJSIP_URI_SCHEME_IS_SIP(uri) && !PJSIP_URI_SCHEME_IS_SIPS(uri)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
cause = pjsip_param_find(&uri->other_param, &cause_name);
|
||||||
|
|
||||||
if (!cause) {
|
if (!cause) {
|
||||||
return;
|
return;
|
||||||
@@ -377,6 +383,7 @@ static void set_redirecting(struct ast_sip_session *session,
|
|||||||
ast_party_redirecting_init(&data);
|
ast_party_redirecting_init(&data);
|
||||||
memset(&update, 0, sizeof(update));
|
memset(&update, 0, sizeof(update));
|
||||||
|
|
||||||
|
data.reason.code = AST_REDIRECTING_REASON_UNKNOWN;
|
||||||
if (from_info) {
|
if (from_info) {
|
||||||
set_redirecting_id((pjsip_name_addr*)from_info->uri,
|
set_redirecting_id((pjsip_name_addr*)from_info->uri,
|
||||||
&data.from, &update.from);
|
&data.from, &update.from);
|
||||||
|
Reference in New Issue
Block a user