[Asterisk-code-review] res/res ari: Fix null endpoint handle (asterisk[master])
sungtae kim
asteriskteam at digium.com
Fri Nov 16 20:33:18 CST 2018
sungtae kim has uploaded this change for review. ( https://gerrit.asterisk.org/10667
Change subject: res/res_ari: Fix null endpoint handle
......................................................................
res/res_ari: Fix null endpoint handle
res_ari deos not check the endpoint parameter length. And it causes core
dump.
Fixed to check the parameter length. Also fixed memory leak.
ASTERISK-28169
Change-Id: Ibf10a9eb8a2e3a9ee1e13fbe748b2ecf955c3993
---
M res/ari/resource_channels.c
1 file changed, 13 insertions(+), 6 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/67/10667/1
diff --git a/res/ari/resource_channels.c b/res/ari/resource_channels.c
index cdf0f88..be6c675 100644
--- a/res/ari/resource_channels.c
+++ b/res/ari/resource_channels.c
@@ -1748,18 +1748,25 @@
struct ast_format_cap *request_cap;
struct ast_channel *originator;
- chan_data = ast_calloc(1, sizeof(*chan_data));
- if (!chan_data) {
- ast_ari_response_alloc_failed(response);
- return;
- }
-
+ /* validate request */
if (!ast_strlen_zero(args->originator) && !ast_strlen_zero(args->formats)) {
ast_ari_response_error(response, 400, "Bad Request",
"Originator and formats can't both be specified");
return;
}
+ if (ast_strlen_zero(args->endpoint)) {
+ ast_ari_response_error(response, 400, "Bad Request",
+ "Endpoint must be specified");
+ return;
+ }
+
+ chan_data = ast_calloc(1, sizeof(*chan_data));
+ if (!chan_data) {
+ ast_ari_response_alloc_failed(response);
+ return;
+ }
+
chan_data->stasis_stuff = ast_str_create(32);
if (!chan_data->stasis_stuff) {
ast_ari_response_alloc_failed(response);
--
To view, visit https://gerrit.asterisk.org/10667
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibf10a9eb8a2e3a9ee1e13fbe748b2ecf955c3993
Gerrit-Change-Number: 10667
Gerrit-PatchSet: 1
Gerrit-Owner: sungtae kim <pchero21 at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20181116/7e22587b/attachment-0001.html>
More information about the asterisk-code-review
mailing list