[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:17:19 CST 2017


George Joseph has uploaded this change for review. ( 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(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/85/7585/1

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: newchange
Gerrit-Change-Id: I57c6229954a38145da9810fc18657bfcc4d9d0c9
Gerrit-Change-Number: 7585
Gerrit-PatchSet: 1
Gerrit-Owner: George Joseph <gjoseph at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20171214/7837d2b6/attachment.html>


More information about the asterisk-code-review mailing list