summaryrefslogtreecommitdiff
path: root/res/res_pjsip
diff options
context:
space:
mode:
authorAaron An <anjb@ti-net.com.cn>2017-11-06 12:06:15 +0800
committerJoshua Colp <jcolp@digium.com>2017-11-07 10:33:17 -0500
commit4c4772472ebd8ba98dfddfb235da1c44445cd8e1 (patch)
tree0a6bafb824bf97dca5042be92b0f5c0ad5566767 /res/res_pjsip
parentcac4dd360dbe5492787967985b44685f79e1fa2c (diff)
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
Diffstat (limited to 'res/res_pjsip')
-rw-r--r--res/res_pjsip/location.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/res/res_pjsip/location.c b/res/res_pjsip/location.c
index 9945c7c10..0d7b3da31 100644
--- a/res/res_pjsip/location.c
+++ b/res/res_pjsip/location.c
@@ -1219,6 +1219,11 @@ static int contact_apply_handler(const struct ast_sorcery *sorcery, void *object
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);