summaryrefslogtreecommitdiff
path: root/res/res_pjsip.c
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2018-01-04 17:42:59 -0600
committerRichard Mudgett <rmudgett@digium.com>2018-01-05 18:08:12 -0600
commit705e6c04b3aec541901b4c592df46af3a2924d23 (patch)
tree0a54aeca345eeadf6c1bdf140ade48fe8d6540c3 /res/res_pjsip.c
parent4eccf697e1c9ee87655cf8a56449dc353cec8a66 (diff)
res_pjsip.c: Fix endpoint identifier registration name search.
If an endpoint identifier name in the endpoint_identifier_order list is a prefix to the identifier we are registering, we could install it in the wrong position of the list. Assuming endpoint_identifier_order=username,ip,anonymous then registering the "ip_only" identifier would put the identifier in the wrong position of the priority list. * Fix incorrect strncmp() string prefix matching. Change-Id: Ib8819ec4b811da8a27419fd93528c54d34f01484
Diffstat (limited to 'res/res_pjsip.c')
-rw-r--r--res/res_pjsip.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/res/res_pjsip.c b/res/res_pjsip.c
index c3deb98b1..654f4ba4e 100644
--- a/res/res_pjsip.c
+++ b/res/res_pjsip.c
@@ -2680,13 +2680,13 @@ int ast_sip_register_endpoint_identifier_with_name(struct ast_sip_endpoint_ident
id_list_item = ast_calloc(1, sizeof(*id_list_item));
if (!id_list_item) {
- ast_log(LOG_ERROR, "Unabled to add endpoint identifier. Out of memory.\n");
+ ast_log(LOG_ERROR, "Unable to add endpoint identifier. Out of memory.\n");
return -1;
}
id_list_item->identifier = identifier;
id_list_item->name = name;
- ast_debug(1, "Register endpoint identifier %s (%p)\n", name, identifier);
+ ast_debug(1, "Register endpoint identifier %s(%p)\n", name ?: "", identifier);
if (ast_strlen_zero(name)) {
/* if an identifier has no name then place in front */
@@ -2709,7 +2709,8 @@ int ast_sip_register_endpoint_identifier_with_name(struct ast_sip_endpoint_ident
id_list_item->priority = 0;
while ((current = strchr(current, ','))) {
++id_list_item->priority;
- if (!strncmp(prev, name, current - prev)) {
+ if (!strncmp(prev, name, current - prev)
+ && strlen(name) == current - prev) {
break;
}
prev = ++current;