summaryrefslogtreecommitdiff
path: root/channels
diff options
context:
space:
mode:
authorScott Griepentrog <sgriepentrog@digium.com>2014-02-26 19:00:56 +0000
committerScott Griepentrog <sgriepentrog@digium.com>2014-02-26 19:00:56 +0000
commit5a46d69543a7a485be624d1a95cf84bb9241ecb6 (patch)
tree6c774ca021036e3c43419120a52b9f8f60b70c54 /channels
parent0e279c215e1935379f9a62c91f59f83c961c9c88 (diff)
pjsip: avoid edge case potential crash in answer()
When accidentally compiling against a wrong version of pjsip headers with a different pjsip_inv_session size, the invite_tsx structure could be null in the answer() function. This led to a crash because it attempted to send the session response with an uninitialized packet pointer. This patch presets packet to null and adds a diagnostic log message to explain why the call fails. Review: https://reviewboard.asterisk.org/r/3267/ ........ Merged revisions 408970 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@408971 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_pjsip.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/channels/chan_pjsip.c b/channels/chan_pjsip.c
index af0496a90..e324b3347 100644
--- a/channels/chan_pjsip.c
+++ b/channels/chan_pjsip.c
@@ -438,12 +438,15 @@ static struct ast_channel *chan_pjsip_new(struct ast_sip_session *session, int s
static int answer(void *data)
{
pj_status_t status = PJ_SUCCESS;
- pjsip_tx_data *packet;
+ pjsip_tx_data *packet = NULL;
struct ast_sip_session *session = data;
pjsip_dlg_inc_lock(session->inv_session->dlg);
if (session->inv_session->invite_tsx) {
status = pjsip_inv_answer(session->inv_session, 200, NULL, NULL, &packet);
+ } else {
+ ast_log(LOG_ERROR,"Cannot answer '%s' because there is no associated SIP transaction\n",
+ ast_channel_name(session->channel));
}
pjsip_dlg_dec_lock(session->inv_session->dlg);