[Asterisk-code-review] res/res_pjsip_diversion: prevent crash on tel: uri in History-Info (asterisk[master])
George Joseph
asteriskteam at digium.com
Wed Dec 23 09:50:42 CST 2020
Attention is currently required from: Torrey Searle.
Hello Torrey Searle,
I'd like you to do a code review. Please visit
https://gerrit.asterisk.org/c/asterisk/+/15273
to review the following change.
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
(cherry picked from commit a7aea71e60d513af82c6e3825e2308e063139b63)
---
M res/res_pjsip_diversion.c
1 file changed, 9 insertions(+), 2 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/73/15273/1
diff --git a/res/res_pjsip_diversion.c b/res/res_pjsip_diversion.c
index 7153b54..24d1781 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/+/15273
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: I0320aa205f22cda511d60a2edf2b037e8fd6cc37
Gerrit-Change-Number: 15273
Gerrit-PatchSet: 1
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Torrey Searle <tsearle at gmail.com>
Gerrit-Attention: Torrey Searle <tsearle at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20201223/a1015129/attachment-0001.html>
More information about the asterisk-code-review
mailing list