]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
AST-2018-005: Add a check for NULL tdata in ast_sip_failover_request
authorGeorge Joseph <gjoseph@digium.com>
Tue, 6 Feb 2018 17:21:32 +0000 (10:21 -0700)
committerGeorge Joseph <gjoseph@digium.com>
Wed, 21 Feb 2018 14:57:08 +0000 (07:57 -0700)
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

res/res_pjsip.c

index 62d282b755b2b57ceb3ce72b44fcdff8a6a28d19..8789d4d131856b24791dd405338879652f78aad4 100644 (file)
@@ -4017,7 +4017,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;
        }