diff options
author | Ashley Sanders <asanders@digium.com> | 2015-01-20 16:51:44 +0000 |
---|---|---|
committer | Ashley Sanders <asanders@digium.com> | 2015-01-20 16:51:44 +0000 |
commit | a7ba8a58a86235eaf88850df03b6865413525b4e (patch) | |
tree | dc9b6a1b6104b1d889844d5f18ca11ca7686f515 | |
parent | 6af6a216a1fcfb1dcefbfa6dc657d3781f3a24d9 (diff) |
ARI: Fixed crash that occurred when updating a bridge when the optional query parameter 'name' was not supplied.
Prior to this changeset, posting to the: /ari/bridges/{bridgeId} endpoint without specifying a value for the [name] query parameter, would crash Asterisk if the bridge you are attempting to create (or update) had the same ID as an existing bridge. The internal mechanism of the POST operation interpreted a null value for name, thus resulting in an error condition that crashed Asterisk.
ASTERISK-24560 #close
Reported By: Kinsey Moore
Review: https://reviewboard.asterisk.org/r/4349/
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@430818 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r-- | res/ari/resource_bridges.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/res/ari/resource_bridges.c b/res/ari/resource_bridges.c index 45fa09d13..2dfb1cf9b 100644 --- a/res/ari/resource_bridges.c +++ b/res/ari/resource_bridges.c @@ -949,16 +949,18 @@ void ast_ari_bridges_create_or_update_with_id(struct ast_variable *headers, if (bridge) { /* update */ - if (strcmp(args->name, bridge->name)) { - ast_ari_response_error( - response, 500, "Internal Error", - "Changing bridge name is not implemented"); - return; + if (!ast_strlen_zero(args->name)) { + if (!strcmp(args->name, bridge->name)) { + ast_ari_response_error( + response, 500, "Internal Error", + "Changing bridge name is not implemented"); + return; + } } if (!ast_strlen_zero(args->type)) { ast_ari_response_error( response, 500, "Internal Error", - "Changing bridge type is not implemented"); + "Supplying a bridge type when updating a bridge is not allowed."); return; } ast_ari_response_ok(response, |