[Asterisk-code-review] res pjsip sdp rtp: Add NULL check in add crypto to stream (asterisk[master])

George Joseph asteriskteam at digium.com
Thu Dec 14 14:22:23 CST 2017


George Joseph has submitted this change and it was merged. ( https://gerrit.asterisk.org/7585 )

Change subject: res_pjsip_sdp_rtp: Add NULL check in add_crypto_to_stream
......................................................................

res_pjsip_sdp_rtp: Add NULL check in add_crypto_to_stream

add_crypto_to_stream wasn't checking for a NULL
session->inv_session->neg before calling pjmedia_sdp_neg_get_state.
This was causing a crash if the negotiation hadn't already been
completed and asterisk was compiled with --enable-dev-mode.

Change-Id: I57c6229954a38145da9810fc18657bfcc4d9d0c9
---
M res/res_pjsip_sdp_rtp.c
1 file changed, 2 insertions(+), 1 deletion(-)

Approvals:
  Joshua Colp: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, approved; Approved for Submit



diff --git a/res/res_pjsip_sdp_rtp.c b/res/res_pjsip_sdp_rtp.c
index a877582..854ed14 100644
--- a/res/res_pjsip_sdp_rtp.c
+++ b/res/res_pjsip_sdp_rtp.c
@@ -1253,7 +1253,8 @@
 		/* If this is an answer we need to use our current state, if it's an offer we need to use
 		 * the configured value.
 		 */
-		if (pjmedia_sdp_neg_get_state(session->inv_session->neg) != PJMEDIA_SDP_NEG_STATE_DONE) {
+		if (session->inv_session->neg
+			&& pjmedia_sdp_neg_get_state(session->inv_session->neg) != PJMEDIA_SDP_NEG_STATE_DONE) {
 			setup = dtls->get_setup(session_media->rtp);
 		} else {
 			setup = session->endpoint->media.rtp.dtls_cfg.default_setup;

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

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I57c6229954a38145da9810fc18657bfcc4d9d0c9
Gerrit-Change-Number: 7585
Gerrit-PatchSet: 1
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20171214/661449f1/attachment.html>


More information about the asterisk-code-review mailing list