<p>George Joseph has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/10235">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">app_voicemail:  Fix stack overrun in append_mailbox<br><br>The append_mailbox function wasn't calculating the correct length<br>to pass to ast_alloca and it wasn't handling the case where context<br>might be empty.<br><br>Found by the Address Sanitizer.<br><br>Change-Id: I7eb51c7bd18a7a8dbdba261462a95cc69e84f161<br>---<br>M apps/app_voicemail.c<br>1 file changed, 7 insertions(+), 4 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/35/10235/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c</span><br><span>index f2b6c97..7b43ea0 100644</span><br><span>--- a/apps/app_voicemail.c</span><br><span>+++ b/apps/app_voicemail.c</span><br><span>@@ -12288,6 +12288,7 @@</span><br><span>         char *mailbox_full;</span><br><span>  int new = 0, old = 0, urgent = 0;</span><br><span>    char secretfn[PATH_MAX] = "";</span><br><span style="color: hsl(120, 100%, 40%);">+       size_t len;</span><br><span> </span><br><span>      tmp = ast_strdupa(data);</span><br><span> </span><br><span>@@ -12324,10 +12325,12 @@</span><br><span>             read_password_from_file(secretfn, vmu->password, sizeof(vmu->password));</span><br><span>       }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-   mailbox_full = ast_alloca(strlen(box) + strlen(context) + 1);</span><br><span style="color: hsl(0, 100%, 40%);">-   strcpy(mailbox_full, box);</span><br><span style="color: hsl(0, 100%, 40%);">-      strcat(mailbox_full, "@");</span><br><span style="color: hsl(0, 100%, 40%);">-    strcat(mailbox_full, context);</span><br><span style="color: hsl(120, 100%, 40%);">+        len = sizeof(box) + sizeof(context) + sizeof('@') + 1;</span><br><span style="color: hsl(120, 100%, 40%);">+        mailbox_full = ast_alloca(len);</span><br><span style="color: hsl(120, 100%, 40%);">+       snprintf(mailbox_full, len, "%s%s%s",</span><br><span style="color: hsl(120, 100%, 40%);">+               box,</span><br><span style="color: hsl(120, 100%, 40%);">+          ast_strlen_zero(context) ? "" : "@",</span><br><span style="color: hsl(120, 100%, 40%);">+              context);</span><br><span> </span><br><span>        inboxcount2(mailbox_full, &urgent, &new, &old);</span><br><span> #ifdef IMAP_STORAGE</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/10235">change 10235</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/10235"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 13 </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I7eb51c7bd18a7a8dbdba261462a95cc69e84f161 </div>
<div style="display:none"> Gerrit-Change-Number: 10235 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: George Joseph <gjoseph@digium.com> </div>