[asterisk-commits] res pjsip t38: Make t38 reinvite response cb tolerant of NU... (asterisk[13])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Sep 6 06:52:56 CDT 2017


Jenkins2 has submitted this change and it was merged. ( https://gerrit.asterisk.org/6384 )

Change subject: res_pjsip_t38:  Make t38_reinvite_response_cb tolerant of NULL channel
......................................................................

res_pjsip_t38:  Make t38_reinvite_response_cb tolerant of NULL channel

t38_reinvite_response_cb can get called by res_pjsip_session's
session_inv_on_tsx_state_changed in situations where session->channel
is NULL.  If it is, the ast_log warning segfaults because it tries
to get the channel name from a NULL channel.

* Check session->channel and print "unknown channel" when it's NULL.

ASTERISK-27236
Reported by: Ross Beer

Change-Id: I4326e288d36327f6c79ab52226d54905cdc87dc7
---
M res/res_pjsip_t38.c
1 file changed, 4 insertions(+), 3 deletions(-)

Approvals:
  Richard Mudgett: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved
  Jenkins2: Approved for Submit



diff --git a/res/res_pjsip_t38.c b/res/res_pjsip_t38.c
index 648c753..128c789 100644
--- a/res/res_pjsip_t38.c
+++ b/res/res_pjsip_t38.c
@@ -294,21 +294,22 @@
 {
 	struct pjsip_status_line status = rdata->msg_info.msg->line.status;
 	struct t38_state *state;
-	RAII_VAR(struct ast_sip_session_media *, session_media, NULL, ao2_cleanup);
+	struct ast_sip_session_media *session_media = NULL;
 
 	if (status.code == 100) {
 		return 0;
 	}
 
-	if (!(state = t38_state_get_or_alloc(session)) ||
+	if (!session->channel || !(state = t38_state_get_or_alloc(session)) ||
 		!(session_media = ao2_find(session->media, "image", OBJ_KEY))) {
 		ast_log(LOG_WARNING, "Received response to T.38 re-invite on '%s' but state unavailable\n",
-			ast_channel_name(session->channel));
+			session->channel ? ast_channel_name(session->channel) : "unknown channel");
 		return 0;
 	}
 
 	t38_change_state(session, session_media, state, (status.code == 200) ? T38_ENABLED : T38_REJECTED);
 
+	ao2_cleanup(session_media);
 	return 0;
 }
 

-- 
To view, visit https://gerrit.asterisk.org/6384
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: merged
Gerrit-Change-Id: I4326e288d36327f6c79ab52226d54905cdc87dc7
Gerrit-Change-Number: 6384
Gerrit-PatchSet: 2
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-commits/attachments/20170906/4ee19719/attachment-0001.html>


More information about the asterisk-commits mailing list