AST-2018-005: Add a check for NULL tdata in ast_sip_failover_request

It was discovered that there are some corner cases where a pjsip tsx
might have no last_tx so calling ast_sip_failover_request with
a NULL last_tx as its tdata would cause a crash.

ASTERISK-27618
Reported By:  Sandro Gauci

Change-Id: Ic2b63f6d4ae617c4c19dcdec2a7a6156b54fd15b
pull/9/head
George Joseph 7 years ago
parent a1e6320c4a
commit c53d8dcb68

@ -4173,7 +4173,8 @@ int ast_sip_failover_request(pjsip_tx_data *tdata)
{ {
pjsip_via_hdr *via; pjsip_via_hdr *via;
if (!tdata->dest_info.addr.count || (tdata->dest_info.cur_addr == tdata->dest_info.addr.count - 1)) { if (!tdata || !tdata->dest_info.addr.count
|| (tdata->dest_info.cur_addr == tdata->dest_info.addr.count - 1)) {
/* No more addresses to try */ /* No more addresses to try */
return 0; return 0;
} }

Loading…
Cancel
Save