[Asterisk-code-review] res/res_pjsip_diversion: prevent crash on tel: uri in History-Info (asterisk[13.38])
George Joseph
asteriskteam at digium.com
Tue Dec 22 14:47:57 CST 2020
George Joseph has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/15262 )
Change subject: res/res_pjsip_diversion: prevent crash on tel: uri in History-Info
......................................................................
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
---
M res/res_pjsip_diversion.c
1 file changed, 9 insertions(+), 2 deletions(-)
Approvals:
George Joseph: Looks good to me, approved; Approved for Submit
diff --git a/res/res_pjsip_diversion.c b/res/res_pjsip_diversion.c
index 5b400d2..08f75e0 100644
--- a/res/res_pjsip_diversion.c
+++ b/res/res_pjsip_diversion.c
@@ -314,8 +314,14 @@
{
static const pj_str_t cause_name = { "cause", 5 };
pjsip_sip_uri *uri = pjsip_uri_get_uri(name_addr);
- pjsip_param *cause = pjsip_param_find(&uri->other_param, &cause_name);
- unsigned long cause_value;
+ pjsip_param *cause = NULL;
+ 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) {
return;
@@ -377,6 +383,7 @@
ast_party_redirecting_init(&data);
memset(&update, 0, sizeof(update));
+ data.reason.code = AST_REDIRECTING_REASON_UNKNOWN;
if (from_info) {
set_redirecting_id((pjsip_name_addr*)from_info->uri,
&data.from, &update.from);
--
To view, visit https://gerrit.asterisk.org/c/asterisk/+/15262
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 13.38
Gerrit-Change-Id: I0320aa205f22cda511d60a2edf2b037e8fd6cc37
Gerrit-Change-Number: 15262
Gerrit-PatchSet: 2
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Torrey Searle <tsearle at gmail.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20201222/4d7099b5/attachment-0001.html>
More information about the asterisk-code-review
mailing list