<p>Friendly Automation <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/14499">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Joshua Colp: Looks good to me, but someone else must approve
Sean Bright: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved
Friendly Automation: Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">pjsip: Prevent invalid memory access when attempting to contact a non-sip URI<br><br>You cannot cast a pjsip_uri to a pjsip_sip_uri using pjsip_uri_get_uri,<br>without checking that it's a PJSIP_URI_SCHEME_IS_SIP(S).<br><br>ASTERISK-28936<br><br>Change-Id: I9f572b3677e4730458e9402719e580f8681afe2a<br>---<br>M res/res_pjsip.c<br>1 file changed, 6 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/res/res_pjsip.c b/res/res_pjsip.c</span><br><span>index 8ab58e0..af3b74e 100644</span><br><span>--- a/res/res_pjsip.c</span><br><span>+++ b/res/res_pjsip.c</span><br><span>@@ -3588,6 +3588,12 @@</span><br><span> pj_cstr(&target_uri, uri);</span><br><span> </span><br><span> res = pjsip_dlg_create_uac(pjsip_ua_instance(), &local_uri, NULL, &remote_uri, &target_uri, &dlg);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (res == PJ_SUCCESS && !(PJSIP_URI_SCHEME_IS_SIP(dlg->target) || PJSIP_URI_SCHEME_IS_SIPS(dlg->target))) {</span><br><span style="color: hsl(120, 100%, 40%);">+ /* dlg->target is a pjsip_other_uri, but it's assumed to be a</span><br><span style="color: hsl(120, 100%, 40%);">+ * pjsip_sip_uri below. Fail fast. */</span><br><span style="color: hsl(120, 100%, 40%);">+ res = PJSIP_EINVALIDURI;</span><br><span style="color: hsl(120, 100%, 40%);">+ pjsip_dlg_terminate(dlg);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span> if (res != PJ_SUCCESS) {</span><br><span> if (res == PJSIP_EINVALIDURI) {</span><br><span> ast_log(LOG_ERROR,</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/14499">change 14499</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/14499"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 17 </div>
<div style="display:none"> Gerrit-Change-Id: I9f572b3677e4730458e9402719e580f8681afe2a </div>
<div style="display:none"> Gerrit-Change-Number: 14499 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: Walter Doekes <walter+asterisk@wjd.nu> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@sangoma.com> </div>
<div style="display:none"> Gerrit-Reviewer: Sean Bright <sean.bright@gmail.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>