<p style="white-space: pre-wrap; word-wrap: break-word;">Looks like the gcc 10 fixes made things worse with this function. ðŸ˜ž</p><p>Patch set 1:<span style="border-radius: 3px; display: inline-block; margin: 0 2px; padding: 4px;background-color: #ffd4d4; color: #000000;">Code-Review -1</span></p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/14731">View Change</a></p><p>4 comments:</p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.asterisk.org/c/asterisk/+/14731/1//COMMIT_MSG">Commit Message:</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/asterisk/+/14731/1//COMMIT_MSG@12">Patch Set #1, Line 12:</a> <code style="font-family:monospace,monospace"></code></p><p style="white-space: pre-wrap; word-wrap: break-word;">ASTERISK-29029 needs to be on a line by itself in the commit message.</p></li></ul></li><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.asterisk.org/c/asterisk/+/14731/1/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/asterisk/+/14731/1/apps/app_voicemail.c@13357">Patch Set #1, Line 13357:</a> <code style="font-family:monospace,monospace"> len = sizeof(*mwi_sub) + 1;</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">I think an end-of-line comment here:<br>/* Allow for mwi_sub->mailbox string terminator */</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/c/asterisk/+/14731/1/apps/app_voicemail.c@13361">Patch Set #1, Line 13361:</a> <code style="font-family:monospace,monospace">  context_len = strlen(p->context) + 1; /* Allow for seperator */</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">@kharwell possible NULL pointer dereference here.  p-mailbox, p->context, and p->uniqueid might be NULL on entry to this function due to malloc failure.  Thus their usage needs to be protected with a NULL check such as !ast_strlen_zero().</p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">size_t context_len = 0;<br>...<br>if (!ast_strlen_zero(p->context)) {<br>    context_len = strlen(p->context) + 1; /* Allow for separator */<br>    len += context_len;<br>}</pre></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/c/asterisk/+/14731/1/apps/app_voicemail.c@13374">Patch Set #1, Line 13374:</a> <code style="font-family:monospace,monospace">                ast_copy_string(mwi_sub->mailbox + strlen(p->mailbox)+1, p->context, context_len);</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">A safer thing to do would be to strlen(mwi_sub->mailbox) instead of strlen(p->mailbox)+1.  p->mailbox might be NULL.</p></li></ul></li></ul><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/14731">change 14731</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/+/14731"/><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: I8be59d175b2b48e4d5b806df5581ac01a01531a3 </div>
<div style="display:none"> Gerrit-Change-Number: 14731 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Karsten Wemheuer <kwe-digium@iptam.com> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: Richard Mudgett <rmudgett@digium.com> </div>
<div style="display:none"> Gerrit-Comment-Date: Sat, 15 Aug 2020 22:19:35 +0000 </div>
<div style="display:none"> Gerrit-HasComments: Yes </div>
<div style="display:none"> Gerrit-Has-Labels: Yes </div>
<div style="display:none"> Gerrit-MessageType: comment </div>