<p>Richard Mudgett has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/7842">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_pjsip.c: Fix endpoint identifier registration name search.<br><br>If an endpoint identifier name in the endpoint_identifier_order list is a<br>prefix to the identifier we are registering, we could install it in the<br>wrong position of the list.<br><br>Assuming<br>endpoint_identifier_order=username,ip,anonymous<br><br>then registering the "ip_only" identifier would put the identifier in the<br>wrong position of the priority list.<br><br>* Fix incorrect strncmp() string prefix matching.<br><br>Change-Id: Ib8819ec4b811da8a27419fd93528c54d34f01484<br>---<br>M res/res_pjsip.c<br>1 file changed, 4 insertions(+), 3 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/42/7842/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/res/res_pjsip.c b/res/res_pjsip.c<br>index 972ea0b..7ee15ac 100644<br>--- a/res/res_pjsip.c<br>+++ b/res/res_pjsip.c<br>@@ -2622,13 +2622,13 @@<br> <br> id_list_item = ast_calloc(1, sizeof(*id_list_item));<br> if (!id_list_item) {<br>- ast_log(LOG_ERROR, "Unabled to add endpoint identifier. Out of memory.\n");<br>+ ast_log(LOG_ERROR, "Unable to add endpoint identifier. Out of memory.\n");<br> return -1;<br> }<br> id_list_item->identifier = identifier;<br> id_list_item->name = name;<br> <br>- ast_debug(1, "Register endpoint identifier %s (%p)\n", name, identifier);<br>+ ast_debug(1, "Register endpoint identifier %s(%p)\n", name ?: "", identifier);<br> <br> if (ast_strlen_zero(name)) {<br> /* if an identifier has no name then place in front */<br>@@ -2651,7 +2651,8 @@<br> id_list_item->priority = 0;<br> while ((current = strchr(current, ','))) {<br> ++id_list_item->priority;<br>- if (!strncmp(prev, name, current - prev)) {<br>+ if (!strncmp(prev, name, current - prev)<br>+ && strlen(name) == current - prev) {<br> break;<br> }<br> prev = ++current;<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/7842">change 7842</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/7842"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 15 </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Ib8819ec4b811da8a27419fd93528c54d34f01484 </div>
<div style="display:none"> Gerrit-Change-Number: 7842 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Richard Mudgett <rmudgett@digium.com> </div>