<p>Robert Sutton has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/14144">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">core: Fix NPE in ast_manager_build_channel_state_string when snapshot is NULL<br><br>There appear to be more than 10 paths where a snapshot is passed to<br>ast_manager_build_channel_state_string without checking that it is not NULL.<br><br>While they could be fixed, it would only lead to re-occurances of this<br>problem in the future.<br><br>As ast_manager_build_channel_state_string may normally return NULL,<br>a NULL check on snapshot has been added and the method will<br>return NULL if snapshot is NULL.<br><br>A WARNING level log has also been added to help with debugging any future<br>secondary issues that might arrise.<br><br>ASTERISK-28810<br><br>Change-Id: I3393e4d521ab6c4551b5434d013a5941706c28de<br>---<br>M main/manager_channels.c<br>1 file changed, 6 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/44/14144/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/main/manager_channels.c b/main/manager_channels.c</span><br><span>index c964033..a50c4f4 100644</span><br><span>--- a/main/manager_channels.c</span><br><span>+++ b/main/manager_channels.c</span><br><span>@@ -493,6 +493,12 @@</span><br><span>   char *connected_name;</span><br><span>        int res;</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+  if (!snapshot)</span><br><span style="color: hsl(120, 100%, 40%);">+        {</span><br><span style="color: hsl(120, 100%, 40%);">+             ast_log(AST_LOG_WARNING, "Call to ast_manager_build_channel_state_string_prefix with NULL snapshot!\n");</span><br><span style="color: hsl(120, 100%, 40%);">+            return NULL;</span><br><span style="color: hsl(120, 100%, 40%);">+  }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>  if (snapshot->tech_properties & AST_CHAN_TP_INTERNAL) {</span><br><span>               return NULL;</span><br><span>         }</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/14144">change 14144</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/+/14144"/><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: I3393e4d521ab6c4551b5434d013a5941706c28de </div>
<div style="display:none"> Gerrit-Change-Number: 14144 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Robert Sutton <rsutton@noojee.com.au> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>