From: Joshua Colp Date: Tue, 13 Sep 2016 11:08:18 +0000 (-0400) Subject: res_pjsip: Don't assume a request will have any addresses. X-Git-Tag: 14.1.0-rc1~57^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b6207cab24f50135a873cda75fcca57a75d59f45;p=thirdparty%2Fasterisk.git res_pjsip: Don't assume a request will have any addresses. 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 --- diff --git a/res/res_pjsip.c b/res/res_pjsip.c index 34edc8ca51..8ecdb03825 100644 --- a/res/res_pjsip.c +++ b/res/res_pjsip.c @@ -3578,7 +3578,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; }