[svn-commits] rmudgett: branch 12 r401107 - /branches/12/res/ari/resource_playback.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Oct 16 16:20:22 CDT 2013


Author: rmudgett
Date: Wed Oct 16 16:20:21 2013
New Revision: 401107

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=401107
Log:
ARI: Fix crash when POST /playback/{id}/control does not have an operation parameter.

(closes issue ASTERISK-22680)
Reported by: John Bigelow

Modified:
    branches/12/res/ari/resource_playback.c

Modified: branches/12/res/ari/resource_playback.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/res/ari/resource_playback.c?view=diff&rev=401107&r1=401106&r2=401107
==============================================================================
--- branches/12/res/ari/resource_playback.c (original)
+++ branches/12/res/ari/resource_playback.c Wed Oct 16 16:20:21 2013
@@ -68,7 +68,6 @@
 	}
 
 	res = stasis_app_playback_operation(playback, STASIS_PLAYBACK_STOP);
-
 	switch (res) {
 	case STASIS_PLAYBACK_OPER_OK:
 		ast_ari_response_no_content(response);
@@ -93,6 +92,11 @@
 	enum stasis_app_playback_media_operation oper;
 	enum stasis_playback_oper_results res;
 
+	if (!args->operation) {
+		ast_ari_response_error(response, 400,
+			"Bad Request", "Missing operation");
+		return;
+	}
 	if (strcmp(args->operation, "unpause") == 0) {
 		oper = STASIS_PLAYBACK_UNPAUSE;
 	} else if (strcmp(args->operation, "pause") == 0) {
@@ -108,7 +112,6 @@
 			"Bad Request", "Invalid operation %s",
 			args->operation);
 		return;
-
 	}
 
 	playback = stasis_app_playback_find_by_id(args->playback_id);
@@ -119,7 +122,6 @@
 	}
 
 	res = stasis_app_playback_operation(playback, oper);
-
 	switch (res) {
 	case STASIS_PLAYBACK_OPER_OK:
 		ast_ari_response_no_content(response);




More information about the svn-commits mailing list