[Asterisk-code-review] res_pjsip_session: Fix segv in session_on_rx_response (asterisk[master])

George Joseph asteriskteam at digium.com
Thu Jul 9 11:18:33 CDT 2020


George Joseph has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/14632 )

Change subject: res_pjsip_session: Fix segv in session_on_rx_response
......................................................................

res_pjsip_session: Fix segv in session_on_rx_response

session_on_rx_response wasn't checking for a NULL dialog before
attempting to get the invite session from it.

Change-Id: Id13534375966cc2eb7f2b55717c9813c63c10065
---
M res/res_pjsip_session.c
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  George Joseph: Looks good to me, approved; Approved for Submit



diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c
index 0cf0c8a..33bfd21 100644
--- a/res/res_pjsip_session.c
+++ b/res/res_pjsip_session.c
@@ -3470,7 +3470,7 @@
 
 	struct pjsip_status_line status = rdata->msg_info.msg->line.status;
 	pjsip_dialog *dlg = pjsip_rdata_get_dlg(rdata);
-	pjsip_inv_session *inv_session = pjsip_dlg_get_inv_session(dlg);
+	pjsip_inv_session *inv_session = dlg ? pjsip_dlg_get_inv_session(dlg) : NULL;
 	struct ast_sip_session *session = (inv_session ? inv_session->mod_data[session_module.id] : NULL);
 	SCOPE_ENTER(1, "%s Method: %.*s Status: %d\n", ast_sip_session_get_name(session),
 		(int)rdata->msg_info.cseq->method.name.slen, rdata->msg_info.cseq->method.name.ptr, status.code);

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

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: Id13534375966cc2eb7f2b55717c9813c63c10065
Gerrit-Change-Number: 14632
Gerrit-PatchSet: 1
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20200709/a5604f9c/attachment.html>


More information about the asterisk-code-review mailing list