]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-4860 --resolve This seems to have come from a malformed file_string in the ringbac...
authorAnthony Minessale <anthm@freeswitch.org>
Wed, 21 Nov 2012 19:06:28 +0000 (13:06 -0600)
committerAnthony Minessale <anthm@freeswitch.org>
Wed, 21 Nov 2012 19:06:28 +0000 (13:06 -0600)
src/mod/applications/mod_dptools/mod_dptools.c
src/switch_core_file.c

index eefd4aad4b62a5cd58adbf254bd8d7ce9d7e61dd..d672e2a3dbe00e04d93bd80a80a1682f0781e9ff 100755 (executable)
@@ -4476,8 +4476,13 @@ static switch_status_t next_file(switch_file_handle_t *handle)
                } else {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error finding the folder path section in '%s'\n", path);
                }
+       }
 
+       if (switch_file_exists(file, handle->memory_pool) != SWITCH_STATUS_SUCCESS) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "File [%s] does not exist.\n", file);
+               goto top;
        }
+
        if (switch_core_file_open(&context->fh, file, handle->channels, handle->samplerate, handle->flags, NULL) != SWITCH_STATUS_SUCCESS) {
                goto top;
        }
index b1a1effc852678b9a4584f9523b83bd7f8d7b6c4..baec6f51845d686bbbd45039a8ba1c04eb9f13f3 100644 (file)
@@ -76,6 +76,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_file_open(const char *file,
                switch_set_flag(fh, SWITCH_FILE_FLAG_FREE_POOL);
        }
 
+       if (switch_directory_exists(file_path, fh->memory_pool) == SWITCH_STATUS_SUCCESS) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "File [%s] is a directory not a file.\n", file_path);
+               goto fail;
+       }
 
        if ((rhs = strstr(file_path, SWITCH_URL_SEPARATOR))) {
                switch_copy_string(stream_name, file_path, (rhs + 1) - file_path);
@@ -198,6 +202,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_file_open(const char *file,
 
   fail:
 
+       switch_clear_flag(fh, SWITCH_FILE_OPEN);
+
        if (switch_test_flag(fh, SWITCH_FILE_FLAG_FREE_POOL)) {
                switch_core_destroy_memory_pool(&fh->memory_pool);
        }