<p>Kevin Harwell has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/14810">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">app_voicemail: ensure strings are not NULL/empty before using<br><br>The handle_subscribe function was not checking the passed in strings for<br>NULL in all cases. This patch now checks and makes sure those strings are<br>not NULL/empty before being used.<br><br>Change-Id: I61da04fe2c2bee0a02480f43301203f31de511c0<br>---<br>M apps/app_voicemail.c<br>1 file changed, 5 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/10/14810/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 e7e0a5c..d62882f 100644</span><br><span>--- a/apps/app_voicemail.c</span><br><span>+++ b/apps/app_voicemail.c</span><br><span>@@ -13379,20 +13379,21 @@</span><br><span> unsigned int len;</span><br><span> struct mwi_sub *mwi_sub;</span><br><span> struct mwi_sub_task *p = datap;</span><br><span style="color: hsl(0, 100%, 40%);">- size_t context_len;</span><br><span style="color: hsl(120, 100%, 40%);">+ size_t context_len = 0;</span><br><span> </span><br><span> len = sizeof(*mwi_sub) + 1;</span><br><span> if (!ast_strlen_zero(p->mailbox))</span><br><span> len += strlen(p->mailbox);</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- context_len = strlen(p->context) + 1; /* Allow for seperator */</span><br><span style="color: hsl(0, 100%, 40%);">- if (!ast_strlen_zero(p->context))</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!ast_strlen_zero(p->context)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ context_len = strlen(p->context) + 1; /* Allow for separator */</span><br><span> len += context_len;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span> </span><br><span> if (!(mwi_sub = ast_calloc(1, len)))</span><br><span> return -1;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- mwi_sub->uniqueid = ast_strdup(p->uniqueid);</span><br><span style="color: hsl(120, 100%, 40%);">+ mwi_sub->uniqueid = ast_strdup(p->uniqueid ? p->uniqueid : "");</span><br><span> if (!ast_strlen_zero(p->mailbox))</span><br><span> strcpy(mwi_sub->mailbox, p->mailbox);</span><br><span> </span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/14810">change 14810</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/+/14810"/><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-Change-Id: I61da04fe2c2bee0a02480f43301203f31de511c0 </div>
<div style="display:none"> Gerrit-Change-Number: 14810 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Kevin Harwell <kharwell@digium.com> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>