<p>Joshua Colp <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/19562">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span></span><br></pre><div style="white-space:pre-wrap">Approvals:
  Joshua Colp: Looks good to me, but someone else must approve; Approved for Submit
  Benjamin Keith Ford: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, approved

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">func_presencestate: Fix invalid memory access.<br><br>When parsing information from AstDB while loading,<br>it is possible that certain pointers are never<br>set, which leads to invalid memory access and<br>then, fatally, invalid free attempts on this memory.<br>We now initialize to NULL to prevent this.<br><br>ASTERISK-30311 #close<br><br>Change-Id: I6120681d04fd2c12a9473f35ce95a1f8e74e3929<br>---<br>M funcs/func_presencestate.c<br>1 file changed, 19 insertions(+), 2 deletions(-)<br><br></pre>
<pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/funcs/func_presencestate.c b/funcs/func_presencestate.c</span><br><span>index 6005e48..8aba891 100644</span><br><span>--- a/funcs/func_presencestate.c</span><br><span>+++ b/funcs/func_presencestate.c</span><br><span>@@ -850,8 +850,8 @@</span><br><span>   for (; db_entry; db_entry = db_entry->next) {</span><br><span>             const char *dev_name = strrchr(db_entry->key, '/') + 1;</span><br><span>           enum ast_presence_state state;</span><br><span style="color: hsl(0, 100%, 40%);">-          char *message;</span><br><span style="color: hsl(0, 100%, 40%);">-          char *subtype;</span><br><span style="color: hsl(120, 100%, 40%);">+                char *message = NULL;</span><br><span style="color: hsl(120, 100%, 40%);">+         char *subtype = NULL;</span><br><span>                if (dev_name <= (const char *) 1) {</span><br><span>                       continue;</span><br><span>            }</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/19562">change 19562</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/+/19562"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I6120681d04fd2c12a9473f35ce95a1f8e74e3929 </div>
<div style="display:none"> Gerrit-Change-Number: 19562 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: N A <asterisk@phreaknet.org> </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: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@sangoma.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>