[Asterisk-code-review] res pjsip: Avoid crash when contact uri is empty string (asterisk[15])

Joshua Colp asteriskteam at digium.com
Tue Nov 7 09:33:18 CST 2017


Joshua Colp has uploaded this change for review. ( https://gerrit.asterisk.org/7097


Change subject: res_pjsip:  Avoid crash when contact uri is empty string
......................................................................

res_pjsip:  Avoid crash when contact uri is empty string

Asterisk will crash if contact uri is invalid, so contact_apply_handler
should check if the uri is NULL or empty.

ASTERISK-27393 #close
Reported-by: Aaron An
Tested-by: AaronAn

Change-Id: Ia0309bdc6b697c73c9c736e1caec910b77ca69f5
---
M res/res_pjsip/location.c
1 file changed, 5 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/97/7097/1

diff --git a/res/res_pjsip/location.c b/res/res_pjsip/location.c
index 9945c7c..0d7b3da 100644
--- a/res/res_pjsip/location.c
+++ b/res/res_pjsip/location.c
@@ -1219,6 +1219,11 @@
 	struct ast_sip_contact_status *status;
 	struct ast_sip_contact *contact = object;
 
+	if (ast_strlen_zero(contact->uri)) {
+		ast_log(LOG_ERROR, "A URI on dynamic contact '%s' is empty\n",
+			ast_sorcery_object_get_id(contact));
+		return -1;
+	}
 	status = ast_res_pjsip_find_or_create_contact_status(contact);
 	ao2_cleanup(status);
 

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

Gerrit-Project: asterisk
Gerrit-Branch: 15
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia0309bdc6b697c73c9c736e1caec910b77ca69f5
Gerrit-Change-Number: 7097
Gerrit-PatchSet: 1
Gerrit-Owner: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Aaron An <anjb at ti-net.com.cn>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20171107/bac89642/attachment-0001.html>


More information about the asterisk-code-review mailing list