diff options
author | Mark Michelson <mmichelson@digium.com> | 2015-06-03 17:41:23 -0500 |
---|---|---|
committer | Mark Michelson <mmichelson@digium.com> | 2015-06-03 17:41:23 -0500 |
commit | 92ccffd9e676f04c2959afcc00c1f8739786744f (patch) | |
tree | 57218c099a5fc48ff258ee59f7935d20ee194582 /res/res_pjsip_session.c | |
parent | d355ee7ff3cfe1737d80da874ea93eee340cdf6f (diff) |
res_pjsip: Prevent access of NULL channels.
It is possible to receive incoming requests or responses after the channel
on an ast_sip_session has been destroyed and NULLed out. Handlers of these
sorts of requests or responses need to be prepared for the possibility
that the channel is NULL or else they could cause a crash.
While several places have been amended to deal with NULL channels, there
were still a couple of places that needed updating.
res_pjsip_dtmf_info.c: When handling incoming INFO requests, we need to
return early if there is no channel on the session.
res_pjsip_session.c: When handling a 302 response, we need to stop the
redirecting attempt if there is no channel on the session.
ASTERISK-25148 #close
reported by Mark Michelson
Change-Id: Id1a75ffc3d0eaa168b0b28188fb54d6cf9fc47a9
Diffstat (limited to 'res/res_pjsip_session.c')
-rw-r--r-- | res/res_pjsip_session.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c index 91e3abed8..bbd74eeb5 100644 --- a/res/res_pjsip_session.c +++ b/res/res_pjsip_session.c @@ -2627,6 +2627,10 @@ static pjsip_redirect_op session_inv_on_redirected(pjsip_inv_session *inv, const struct ast_sip_session *session = inv->mod_data[session_module.id]; const pjsip_sip_uri *uri; + if (!session->channel) { + return PJSIP_REDIRECT_STOP; + } + if (session->endpoint->redirect_method == AST_SIP_REDIRECT_URI_PJSIP) { return PJSIP_REDIRECT_ACCEPT; } |