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

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


Joshua Colp has uploaded a new change for review.

  https://gerrit.asterisk.org/3890

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/90/3890/1

diff --git a/res/res_pjsip.c b/res/res_pjsip.c
index f56790d..ae8c4dd 100644
--- a/res/res_pjsip.c
+++ b/res/res_pjsip.c
@@ -3510,7 +3510,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/3890
To unsubscribe, visit https://gerrit.asterisk.org/settings

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



More information about the asterisk-code-review mailing list