<p>sungtae kim has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/10667">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res/res_ari: Fix null endpoint handle<br><br>res_ari deos not check the endpoint parameter length. And it causes core<br>dump.<br>Fixed 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, 13 insertions(+), 6 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/67/10667/1</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..be6c675 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,25 @@</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 style="color: hsl(120, 100%, 40%);">+ /* validate request */</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: newchange </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: 1 </div>
<div style="display:none"> Gerrit-Owner: sungtae kim <pchero21@gmail.com> </div>