]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
res_pjsip: Don't assume a request will have any addresses. 89/3889/1
authorJoshua Colp <jcolp@digium.com>
Tue, 13 Sep 2016 11:08:18 +0000 (07:08 -0400)
committerJoshua Colp <jcolp@digium.com>
Tue, 13 Sep 2016 11:10:06 +0000 (06:10 -0500)
When performing DNS resolution the failover code present in
res_pjsip currently assumes that a request will always have
at least one viable address. In practice this is not true.
A domain may be used that has no records.

The code now checks that at least one address exists on the
request which prevents looping.

ASTERISK-26364 #close

Change-Id: Ic0761b0264864acd85915c94d878a81624940f4c

res/res_pjsip.c

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