<p>Patch set 6:<span style="border-radius: 3px; display: inline-block; margin: 0 2px; padding: 4px;background-color: #ffd4d4;">Code-Review -1</span></p><p><a href="https://gerrit.asterisk.org/10132">View Change</a></p><p>1 comment:</p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.asterisk.org/#/c/10132/6/apps/app_voicemail.c">File apps/app_voicemail.c:</a></p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/10132/6/apps/app_voicemail.c@12195">Patch Set #6, Line 12195:</a> </p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><pre style="font-family: monospace,monospace; white-space: pre-wrap;"> char *mailbox;<br><br> if (!ast_strlen_zero(vmu->mailbox)) {<br> len += strlen(vmu->mailbox);<br> }<br><br> if (!ast_strlen_zero(vmu->context)) {<br> len += strlen(vmu->context) + 1; /* Allow for seperator and terminator */<br> }<br><br> mailbox = ast_alloca(len);<br> if (!ast_strlen_zero(vmu->mailbox)) {<br> strcpy(mailbox, vmu->mailbox); /* Safe */<br> }<br><br> if (!ast_strlen_zero(vmu->context)) {<br> strcat(mailbox, "@"); /* Safe */<br> strcat(mailbox, vmu->context); /* Safe */<br> }<br><br> if (ast_strlen_zero(mailbox)) {<br> ast_log(LOG_ERROR, "Mailbox can't be empty\n");<br> return -1;<br> }<br></pre></blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">I may not be understanding something, but this seems unnecessarily complicated. Wouldn't something like this work?</p><pre style="font-family: monospace,monospace; white-space: pre-wrap;"> char mailbox[AST_MAX_CONTEXT + AST_MAX_EXTENSION + sizeof("@")];</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"> snprintf(mailbox, sizeof(mailbox), "%s@%s", vmu->mailbox, vmu->context);</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"> if (!strcmp(mailbox, "@")) {<br> ast_log(LOG_ERROR, "Mailbox can't be empty\n");<br> return -1;<br> }</pre></li></ul></li></ul><p>To view, visit <a href="https://gerrit.asterisk.org/10132">change 10132</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/10132"/><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: comment </div>
<div style="display:none"> Gerrit-Change-Id: I5cceb737246949f9782955c64425b8bd25a9e9ee </div>
<div style="display:none"> Gerrit-Change-Number: 10132 </div>
<div style="display:none"> Gerrit-PatchSet: 6 </div>
<div style="display:none"> Gerrit-Owner: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Richard Mudgett <rmudgett@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Sean Bright <sean.bright@gmail.com> </div>
<div style="display:none"> Gerrit-Comment-Date: Mon, 17 Sep 2018 22:38:49 +0000 </div>
<div style="display:none"> Gerrit-HasComments: Yes </div>
<div style="display:none"> Gerrit-HasLabels: Yes </div>