]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-11554: fix crash in conference API when no param given to "moh".
authorDragos Oancea <droancea@yahoo.com>
Thu, 6 Dec 2018 02:30:03 +0000 (21:30 -0500)
committerDragos Oancea <droancea@yahoo.com>
Thu, 6 Dec 2018 03:04:00 +0000 (22:04 -0500)
src/mod/applications/mod_conference/conference_api.c

index ec9fee5724583c222d79c9047a0c5f91bd175935..3e15aa9fd80d65629e2342dd996cafdee2bc3b32 100644 (file)
@@ -2709,6 +2709,9 @@ switch_status_t conference_api_sub_file_seek(conference_obj_t *conference, switc
 
 switch_status_t conference_api_set_moh(conference_obj_t *conference, const char *what)
 {
+       if (!what) {
+               return SWITCH_STATUS_FALSE;
+       }
 
        if (!strcasecmp(what, "toggle")) {
                if (conference_utils_test_flag(conference, CFLAG_NO_MOH)) {
@@ -2737,7 +2740,15 @@ switch_status_t conference_api_set_moh(conference_obj_t *conference, const char
 switch_status_t conference_api_sub_moh(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv)
 {
 
-       conference_api_set_moh(conference, argv[2]);
+       if (conference_api_set_moh(conference, argv[2]) == SWITCH_STATUS_SUCCESS) {
+               if (stream) {
+                       stream->write_function(stream, "+OK moh\n");
+               }
+       } else {
+               if (stream) {
+                       stream->write_function(stream, "-ERR invalid moh param\n");
+               }
+       }
 
        return SWITCH_STATUS_SUCCESS;
 }