]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
PJSIP: avoid crash when getting rtp peer 76/1276/1
authorScott Griepentrog <scott@griepentrog.com>
Thu, 17 Sep 2015 18:09:56 +0000 (13:09 -0500)
committerScott Griepentrog <sgriepentrog@digium.com>
Thu, 17 Sep 2015 18:15:20 +0000 (13:15 -0500)
Although unlikely, if the tech private is returned as
a NULL, chan_pjsip_get_rtp_peer() would crash.

ASTERISK-25323

Change-Id: Ie231369bfa7da926fb2b9fdaac228261a3152e6a

channels/chan_pjsip.c

index 49995a2f81e3aeed00e29a42f9f15d2353c430d0..d7e291ddd1afafd2479b43e5eca18302e397cc5b 100644 (file)
@@ -160,10 +160,10 @@ static struct ast_sip_session_supplement chan_pjsip_ack_supplement = {
 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;
        }