<p>N A <strong>uploaded patch set #2</strong> to this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/18833">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">pbx_functions.c: Fix buggy ast_str_strlen.<br><br>When ast_func_read2 is used to read a function using<br>its read function (as opposed to a native ast_str read2<br>function), the result is copied directly by the function<br>into the ast_str buffer. As a result, the ast_str length<br>remains initialized to 0, which is a bug because this is<br>not the real string length.<br><br>This can cascade and have issues elsewhere, such as when<br>reading substrings of functions that only register read<br>as opposed to read2 callbacks. In this case, since reading<br>ast_str_strlen returns 0, the returned substring is empty<br>as opposed to the actual substring. This has caused<br>the ast_str family of functions to behave inconsistently<br>and erroneously, in contrast to the pbx_variables substitution<br>functions which work correctly.<br><br>This fixes this issue by manually updating the ast_str length<br>when the result is copied directly into the ast_str buffer.<br><br>Additionally, an assertion and a unit test that previously<br>exposed these issues are added, now that the issue is fixed.<br><br>ASTERISK-29966 #close<br><br>Change-Id: I4e2dba41410f9d4dff61c995d2ca27718248e07f<br>---<br>M main/pbx_functions.c<br>M main/pbx_variables.c<br>2 files changed, 74 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/33/18833/2</pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/18833">change 18833</a>. To unsubscribe, or for help writing mail filters, 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/c/asterisk/+/18833"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I4e2dba41410f9d4dff61c995d2ca27718248e07f </div>
<div style="display:none"> Gerrit-Change-Number: 18833 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: N A <mail@interlinked.x10host.com> </div>
<div style="display:none"> Gerrit-CC: Friendly Automation </div>
<div style="display:none"> Gerrit-MessageType: newpatchset </div>