From d280278949cd14a729c40856a622038731cd3e97 Mon Sep 17 00:00:00 2001 From: George Joseph Date: Tue, 6 Feb 2018 10:21:32 -0700 Subject: [PATCH 1/3] res_pjsip: 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_failuver_request with a NULL last_tx as its tdata would cause a crash. ASTERISK_27618 Reported By: Sandro Gauci Change-Id: Ic2b63f6d4ae617c4c19dcdec2a7a6156b54fd15b --- res/res_pjsip.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/res/res_pjsip.c b/res/res_pjsip.c index 7867c52c12..ac13652e49 100644 --- a/res/res_pjsip.c +++ b/res/res_pjsip.c @@ -4027,7 +4027,8 @@ int ast_sip_failover_request(pjsip_tx_data *tdata) { 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 */ return 0; } -- 2.14.3