[Asterisk-code-review] res pjsip: Don't assume a request will have any addresses. (asterisk[master])

Joshua Colp asteriskteam at digium.com
Tue Sep 13 06:10:06 CDT 2016


Joshua Colp has uploaded a new change for review.

  https://gerrit.asterisk.org/3889

Change subject: res_pjsip: Don't assume a request will have any addresses.
......................................................................

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
---
M res/res_pjsip.c
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/89/3889/1

diff --git a/res/res_pjsip.c b/res/res_pjsip.c
index 7bb10c0..8a93222 100644
--- a/res/res_pjsip.c
+++ b/res/res_pjsip.c
@@ -3584,7 +3584,7 @@
 {
 	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;
 	}

-- 
To view, visit https://gerrit.asterisk.org/3889
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic0761b0264864acd85915c94d878a81624940f4c
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Joshua Colp <jcolp at digium.com>



More information about the asterisk-code-review mailing list