[Asterisk-code-review] PJSIP: avoid crash when getting rtp peer (asterisk[13])

Scott Griepentrog asteriskteam at digium.com
Thu Sep 17 13:15:20 CDT 2015


Scott Griepentrog has uploaded a new change for review.

  https://gerrit.asterisk.org/1276

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(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/76/1276/1

diff --git a/channels/chan_pjsip.c b/channels/chan_pjsip.c
index 49995a2..d7e291d 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/1276
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie231369bfa7da926fb2b9fdaac228261a3152e6a
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Scott Griepentrog <sgriepentrog at digium.com>



More information about the asterisk-code-review mailing list