[Asterisk-code-review] Fix segfault if Dial() is used on PJSIP and endpoint was uns... (asterisk[13])

snuffy asteriskteam at digium.com
Thu May 14 22:30:28 CDT 2015


snuffy has uploaded a new change for review.

  https://gerrit.asterisk.org/476

Change subject: Fix segfault if Dial() is used on PJSIP and endpoint was unspecified.
......................................................................

Fix segfault if Dial() is used on PJSIP and endpoint was unspecified.

This could happen when the dialplan variable for endpoint is not set,
causing us to try to reference AORs of an non-existant endpoint.

Change this so, ensure we have endpoint before asking for its AORs.

Change-Id: I9de76c2935a1f4e3f0cffe97a670106f5605e89e
---
M res/res_pjsip_session.c
1 file changed, 5 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/76/476/1

diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c
index 87ce2b0..315581e 100644
--- a/res/res_pjsip_session.c
+++ b/res/res_pjsip_session.c
@@ -1442,9 +1442,12 @@
 	struct pjsip_inv_session *inv_session;
 	RAII_VAR(struct ast_sip_session *, session, NULL, ao2_cleanup);
 
-	/* If no location has been provided use the AOR list from the endpoint itself */
+	/* If no location has been provided use the AOR list from the endpoint itself if it exists */
 	if (location || !contact) {
-		location = S_OR(location, endpoint->aors);
+		location = S_OR(location, endpoint ? endpoint->aors : NULL);
+		if (ast_strlen_zero(location)) {
+			return NULL;
+		}
 
 		ast_sip_location_retrieve_contact_and_aor_from_list(location, &found_aor, &found_contact);
 		if (!found_contact || ast_strlen_zero(found_contact->uri)) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9de76c2935a1f4e3f0cffe97a670106f5605e89e
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: snuffy <snuffy22 at gmail.com>



More information about the asterisk-code-review mailing list