From: Kevin Harwell Date: Thu, 30 Oct 2014 21:12:25 +0000 (+0000) Subject: res_pjsip_exten_state: PJSIPShowSubscriptionsInbound causes crash X-Git-Tag: 12.7.0-rc1~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a0b803140b14fd0729bfd12539cda4d8dd4e5c27;p=thirdparty%2Fasterisk.git res_pjsip_exten_state: PJSIPShowSubscriptionsInbound causes crash Currently, it is possible for some subscriptions to get into a NULL state. When this occurs and the PJSIPShowSubscriptionsInbound ami action is issued and a device is subscribed for extension state then the associated subscription state object can't be located. The code then attempts to dereference a NULL object. Added a NULL check to avoid the problem. Reported by: John Bigelow git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@426779 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/res/res_pjsip_exten_state.c b/res/res_pjsip_exten_state.c index e3f8c11e15..5966465f30 100644 --- a/res/res_pjsip_exten_state.c +++ b/res/res_pjsip_exten_state.c @@ -520,6 +520,10 @@ static void to_ami(struct ast_sip_subscription *sub, struct exten_state_subscription *exten_state_sub = get_exten_state_sub(sub); + if (!exten_state_sub) { + return; + } + ast_str_append(buf, 0, "SubscriptionType: extension_state\r\n" "Extension: %s\r\nExtensionStates: %s\r\n", exten_state_sub->exten, ast_extension_state2str(