res_pjsip: Only check transaction on transaction state events.

The send request callback function currently assumes that it
will only ever be called on transaction state changes. This is
not always true. If our own timer callback occurs we will call
the callback with a timer event instead of a transaction state
change event. In this case the transaction on the event is
invalid and accessing it will result in a crash.

ASTERISK-26049 #close

Change-Id: I623211c8533eb73056b0250b4580b49ad4174dfc
This commit is contained in:
Joshua Colp 2016-05-22 13:03:20 -03:00
parent 1c02b19b79
commit 85d0272e76
1 changed files with 39 additions and 37 deletions

View File

@ -3513,6 +3513,7 @@ static void send_request_cb(void *token, pjsip_event *e)
pjsip_rx_data *challenge;
struct ast_sip_supplement *supplement;
if (e->type == PJSIP_EVENT_TSX_STATE) {
switch(e->body.tsx_state.type) {
case PJSIP_EVENT_TRANSPORT_ERROR:
case PJSIP_EVENT_TIMER:
@ -3554,6 +3555,7 @@ static void send_request_cb(void *token, pjsip_event *e)
ast_log(LOG_ERROR, "Unexpected PJSIP event %u\n", e->body.tsx_state.type);
break;
}
}
if (req_data->callback) {
req_data->callback(req_data->token, e);