<p>Joshua Colp <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/10667">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  Joshua Colp: Looks good to me, but someone else must approve; Approved for Submit
  George Joseph: Looks good to me, approved

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res/res_ari: Fix null endpoint handle<br><br>The res_ari(POST /channels/create handler) deos not check the endpoint<br>parameter length. And it causes core<br>dump.<br>Fixed it to check the parameter length. Also fixed memory leak.<br><br>ASTERISK-28169<br><br>Change-Id: Ibf10a9eb8a2e3a9ee1e13fbe748b2ecf955c3993<br>---<br>M res/ari/resource_channels.c<br>1 file changed, 12 insertions(+), 6 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/res/ari/resource_channels.c b/res/ari/resource_channels.c</span><br><span>index cdf0f88..bca32f1 100644</span><br><span>--- a/res/ari/resource_channels.c</span><br><span>+++ b/res/ari/resource_channels.c</span><br><span>@@ -1748,18 +1748,24 @@</span><br><span>    struct ast_format_cap *request_cap;</span><br><span>  struct ast_channel *originator;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-     chan_data = ast_calloc(1, sizeof(*chan_data));</span><br><span style="color: hsl(0, 100%, 40%);">-  if (!chan_data) {</span><br><span style="color: hsl(0, 100%, 40%);">-               ast_ari_response_alloc_failed(response);</span><br><span style="color: hsl(0, 100%, 40%);">-                return;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span>    if (!ast_strlen_zero(args->originator) && !ast_strlen_zero(args->formats)) {</span><br><span>           ast_ari_response_error(response, 400, "Bad Request",</span><br><span>                       "Originator and formats can't both be specified");</span><br><span>             return;</span><br><span>      }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+ if (ast_strlen_zero(args->endpoint)) {</span><br><span style="color: hsl(120, 100%, 40%);">+             ast_ari_response_error(response, 400, "Bad Request",</span><br><span style="color: hsl(120, 100%, 40%);">+                        "Endpoint must be specified");</span><br><span style="color: hsl(120, 100%, 40%);">+              return;</span><br><span style="color: hsl(120, 100%, 40%);">+       }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+   chan_data = ast_calloc(1, sizeof(*chan_data));</span><br><span style="color: hsl(120, 100%, 40%);">+        if (!chan_data) {</span><br><span style="color: hsl(120, 100%, 40%);">+             ast_ari_response_alloc_failed(response);</span><br><span style="color: hsl(120, 100%, 40%);">+              return;</span><br><span style="color: hsl(120, 100%, 40%);">+       }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>  chan_data->stasis_stuff = ast_str_create(32);</span><br><span>     if (!chan_data->stasis_stuff) {</span><br><span>           ast_ari_response_alloc_failed(response);</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/10667">change 10667</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/10667"/><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-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: Ibf10a9eb8a2e3a9ee1e13fbe748b2ecf955c3993 </div>
<div style="display:none"> Gerrit-Change-Number: 10667 </div>
<div style="display:none"> Gerrit-PatchSet: 3 </div>
<div style="display:none"> Gerrit-Owner: sungtae kim <pchero21@gmail.com> </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 (1000185) </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: sungtae kim <pchero21@gmail.com> </div>