[Asterisk-code-review] res pjsip: Avoid crash when contact uri is empty string (asterisk[master])
Aaron An
asteriskteam at digium.com
Sun Nov 5 22:09:09 CST 2017
Aaron An has uploaded this change for review. ( https://gerrit.asterisk.org/6997
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, 4 insertions(+), 0 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/97/6997/1
diff --git a/res/res_pjsip/location.c b/res/res_pjsip/location.c
index 9945c7c..2dd9419 100644
--- a/res/res_pjsip/location.c
+++ b/res/res_pjsip/location.c
@@ -1219,6 +1219,10 @@
struct ast_sip_contact_status *status;
struct ast_sip_contact *contact = object;
+ if(contact->uri == NULL || ast_strlen_zero(contact->uri)){
+ ast_log(LOG_ERROR, "Contact uri is empty\n");
+ return -1;
+ }
status = ast_res_pjsip_find_or_create_contact_status(contact);
ao2_cleanup(status);
--
To view, visit https://gerrit.asterisk.org/6997
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia0309bdc6b697c73c9c736e1caec910b77ca69f5
Gerrit-Change-Number: 6997
Gerrit-PatchSet: 1
Gerrit-Owner: 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/20171105/d36de0a6/attachment.html>
More information about the asterisk-code-review
mailing list