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

Anonymous Coward asteriskteam at digium.com
Tue Sep 13 18:24:44 CDT 2016


Anonymous Coward #1000019 has submitted this change and it was merged.

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(-)

Approvals:
  Mark Michelson: Looks good to me, approved
  Richard Mudgett: Looks good to me, but someone else must approve
  Anonymous Coward #1000019: Verified
  Matt Jordan: Looks good to me, but someone else must approve



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: merged
Gerrit-Change-Id: Ic0761b0264864acd85915c94d878a81624940f4c
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>



More information about the asterisk-code-review mailing list