[asterisk-commits] PJSIP: avoid crash when getting rtp peer (asterisk[master])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Sep 19 08:21:56 CDT 2015


Joshua Colp has submitted this change and it was merged.

Change subject: PJSIP: avoid crash when getting rtp peer
......................................................................


PJSIP: avoid crash when getting rtp peer

Although unlikely, if the tech private is returned as
a NULL, chan_pjsip_get_rtp_peer() would crash.

ASTERISK-25323

Change-Id: Ie231369bfa7da926fb2b9fdaac228261a3152e6a
---
M channels/chan_pjsip.c
1 file changed, 2 insertions(+), 2 deletions(-)

Approvals:
  Richard Mudgett: Looks good to me, but someone else must approve
  Anonymous Coward #1000019: Verified
  Joshua Colp: Looks good to me, approved



diff --git a/channels/chan_pjsip.c b/channels/chan_pjsip.c
index 9603f05..153b2a3 100644
--- a/channels/chan_pjsip.c
+++ b/channels/chan_pjsip.c
@@ -160,10 +160,10 @@
 static enum ast_rtp_glue_result chan_pjsip_get_rtp_peer(struct ast_channel *chan, struct ast_rtp_instance **instance)
 {
 	struct ast_sip_channel_pvt *channel = ast_channel_tech_pvt(chan);
-	struct chan_pjsip_pvt *pvt = channel->pvt;
+	struct chan_pjsip_pvt *pvt;
 	struct ast_sip_endpoint *endpoint;
 
-	if (!pvt || !channel->session || !pvt->media[SIP_MEDIA_AUDIO]->rtp) {
+	if (!channel || !channel->session || !(pvt = channel->pvt) || !pvt->media[SIP_MEDIA_AUDIO]->rtp) {
 		return AST_RTP_GLUE_RESULT_FORBID;
 	}
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie231369bfa7da926fb2b9fdaac228261a3152e6a
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Scott Griepentrog <sgriepentrog at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>



More information about the asterisk-commits mailing list