]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Fix a crash caused by muting and unmuting a channel in ARI without specifying a direc...
authorJoshua Colp <jcolp@digium.com>
Thu, 3 Oct 2013 19:05:36 +0000 (19:05 +0000)
committerJoshua Colp <jcolp@digium.com>
Thu, 3 Oct 2013 19:05:36 +0000 (19:05 +0000)
(closes issue ASTERISK-22637)
Reported by: Scott Griepentrog

Patch by Matt Jordan, whose office I have taken over in the name of Canada.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@400401 65c4cc65-6c06-0410-ace0-fbb531ad65f3

res/ari/resource_channels.c

index 4d5228168a311fc8605d99b58611de630902857e..aaf04a3f887d72c94f79ec88977ad9dbbf281f9c 100644 (file)
@@ -152,6 +152,13 @@ void ast_ari_mute_channel(struct ast_variable *headers, struct ast_mute_channel_
                return;
        }
 
+       if (ast_strlen_zero(args->direction)) {
+               ast_ari_response_error(
+                       response, 400, "Bad Request",
+                       "Direction is required");
+               return;
+       }
+
        if (!strcmp(args->direction, "in")) {
                direction = AST_MUTE_DIRECTION_READ;
        } else if (!strcmp(args->direction, "out")) {
@@ -181,6 +188,13 @@ void ast_ari_unmute_channel(struct ast_variable *headers, struct ast_unmute_chan
                return;
        }
 
+       if (ast_strlen_zero(args->direction)) {
+               ast_ari_response_error(
+                       response, 400, "Bad Request",
+                       "Direction is required");
+               return;
+       }
+
        if (!strcmp(args->direction, "in")) {
                direction = AST_MUTE_DIRECTION_READ;
        } else if (!strcmp(args->direction, "out")) {