<p>Friendly Automation <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/18194">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Joshua Colp: Looks good to me, but someone else must approve
Benjamin Keith Ford: Looks good to me, approved
Friendly Automation: Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">stasis_recording: Perform a complete match on requested filename.<br><br>Using the length of a file found on the filesystem rather than the<br>file being requested could result in filenames whose names are<br>substrings of another to be erroneously matched.<br><br>We now ensure a complete comparison before returning a positive<br>result.<br><br>ASTERISK-29960 #close<br><br>Change-Id: Id3ffc77681b9b75b8569062f3d952a128a21c71a<br>---<br>M res/stasis_recording/stored.c<br>1 file changed, 5 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/res/stasis_recording/stored.c b/res/stasis_recording/stored.c</span><br><span>index 6cdca96..9e9ae58 100644</span><br><span>--- a/res/stasis_recording/stored.c</span><br><span>+++ b/res/stasis_recording/stored.c</span><br><span>@@ -130,6 +130,7 @@</span><br><span> </span><br><span> struct match_recording_data {</span><br><span> const char *file;</span><br><span style="color: hsl(120, 100%, 40%);">+ size_t length;</span><br><span> char *file_with_ext;</span><br><span> };</span><br><span> </span><br><span>@@ -160,7 +161,9 @@</span><br><span> int num;</span><br><span> </span><br><span> /* If not a recording or the names do not match the keep searching */</span><br><span style="color: hsl(0, 100%, 40%);">- if (!(num = is_recording(filename)) || strncmp(data->file, filename, num)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!(num = is_recording(filename))</span><br><span style="color: hsl(120, 100%, 40%);">+ || data->length != num</span><br><span style="color: hsl(120, 100%, 40%);">+ || strncmp(data->file, filename, num)) {</span><br><span> return 0;</span><br><span> }</span><br><span> </span><br><span>@@ -186,6 +189,7 @@</span><br><span> {</span><br><span> struct match_recording_data data = {</span><br><span> .file = file,</span><br><span style="color: hsl(120, 100%, 40%);">+ .length = strlen(file),</span><br><span> .file_with_ext = NULL</span><br><span> };</span><br><span> </span><br><span></span><br></pre><div style="white-space:pre-wrap"></div><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/18194">change 18194</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/+/18194"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 16 </div>
<div style="display:none"> Gerrit-Change-Id: Id3ffc77681b9b75b8569062f3d952a128a21c71a </div>
<div style="display:none"> Gerrit-Change-Number: 18194 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: Sean Bright <sean@seanbright.com> </div>
<div style="display:none"> Gerrit-Reviewer: Benjamin Keith Ford <bford@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@sangoma.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>