summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Joseph <gjoseph@digium.com>2017-12-14 13:05:23 -0700
committerGeorge Joseph <gjoseph@digium.com>2017-12-14 14:17:53 -0600
commit9d63832e280947da08e8c42be6eec51388022d0c (patch)
tree0d70c27d79597d409a1397bf72324179f8b5d00d
parente2f928df533d71609c57f47056f9ad040e15932f (diff)
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
-rw-r--r--res/res_pjsip_sdp_rtp.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/res/res_pjsip_sdp_rtp.c b/res/res_pjsip_sdp_rtp.c
index a87758267..854ed1459 100644
--- a/res/res_pjsip_sdp_rtp.c
+++ b/res/res_pjsip_sdp_rtp.c
@@ -1253,7 +1253,8 @@ static int add_crypto_to_stream(struct ast_sip_session *session,
/* 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;