[Asterisk-code-review] res/res_pjsip_diversion: prevent crash on tel: uri in History-Info (asterisk[16])

Torrey Searle asteriskteam at digium.com
Tue Dec 22 02:59:52 CST 2020


Torrey Searle has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/15229 )


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.

Change-Id: I0320aa205f22cda511d60a2edf2b037e8fd6cc37
---
M res/res_pjsip_diversion.c
1 file changed, 8 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/29/15229/1

diff --git a/res/res_pjsip_diversion.c b/res/res_pjsip_diversion.c
index 7153b54..e5376ed 100644
--- a/res/res_pjsip_diversion.c
+++ b/res/res_pjsip_diversion.c
@@ -314,6 +314,10 @@
 {
 	static const pj_str_t cause_name = { "cause", 5 };
 	pjsip_sip_uri *uri = pjsip_uri_get_uri(name_addr);
+	if ( PJSIP_URI_SCHEME_IS_TEL(uri)) {
+		return;
+	}
+
 	pjsip_param *cause = pjsip_param_find(&uri->other_param, &cause_name);
 	unsigned long cause_value;
 
@@ -377,10 +381,13 @@
 	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);
-		set_redirecting_reason(from_info, to_info, &data.reason);
+		if (to_info) {
+			set_redirecting_reason(from_info, to_info, &data.reason);
+		}
 		ast_set_party_id_all(&update.priv_to);
 	} else {
 		copy_redirecting_id(&data.from, &session->id, &update.from);

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/15229
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-Change-Id: I0320aa205f22cda511d60a2edf2b037e8fd6cc37
Gerrit-Change-Number: 15229
Gerrit-PatchSet: 1
Gerrit-Owner: 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/20201222/321810ef/attachment-0001.html>


More information about the asterisk-code-review mailing list