summaryrefslogtreecommitdiff
path: root/res/res_pjsip_dtmf_info.c
diff options
context:
space:
mode:
authorMark Michelson <mmichelson@digium.com>2015-06-03 17:41:23 -0500
committerMark Michelson <mmichelson@digium.com>2015-06-03 17:43:33 -0500
commit88212ccb7f24b100f9348511cd940c7d2c199966 (patch)
tree0cb106939db228c9295b263ab8c3c28526fa4565 /res/res_pjsip_dtmf_info.c
parent5dc9fb4198f2081f3996c89fb42aaffc0f326df8 (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_dtmf_info.c')
-rw-r--r--res/res_pjsip_dtmf_info.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/res/res_pjsip_dtmf_info.c b/res/res_pjsip_dtmf_info.c
index b0a6649a0..7b52250c8 100644
--- a/res/res_pjsip_dtmf_info.c
+++ b/res/res_pjsip_dtmf_info.c
@@ -89,7 +89,13 @@ static int dtmf_info_incoming_request(struct ast_sip_session *session, struct pj
char event = '\0';
unsigned int duration = 100;
- char is_dtmf = is_media_type(rdata, "dtmf");
+ char is_dtmf;
+
+ if (!session->channel) {
+ return 0;
+ }
+
+ is_dtmf = is_media_type(rdata, "dtmf");
if (!is_dtmf && !is_media_type(rdata, "dtmf-relay")) {
return 0;