From: Wonnam Jang Date: Wed, 4 Apr 2018 06:00:20 +0000 (+0900) Subject: Check passed parameter if null is or not X-Git-Tag: submit/tizen/20180410.122714~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=83aa03e8b0da99bb20f5765254b6b257609f8ac4;p=platform%2Fcore%2Fuifw%2Fvoice-control.git Check passed parameter if null is or not Change-Id: I3d442d7f230bb875d3a04af72080564375ae702c Signed-off-by: Wonnam Jang --- diff --git a/client/vc_mgr.c b/client/vc_mgr.c index c092648..9610204 100644 --- a/client/vc_mgr.c +++ b/client/vc_mgr.c @@ -599,6 +599,11 @@ int vc_mgr_is_command_format_supported(vc_cmd_format_e format, bool* support) { SLOG(LOG_ERROR, TAG_VCM, "@@@ [Manager] Is command type supported"); + if (NULL == support) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Invalid parameter, support is NULL ptr"); + return VC_ERROR_INVALID_PARAMETER; + } + vc_state_e state; if (0 != vc_mgr_client_get_client_state(g_vc_m, &state)) { SLOG(LOG_ERROR, TAG_VCM, "[ERROR] A handle is not available"); @@ -632,6 +637,11 @@ int vc_mgr_enable_command_type(int cmd_type) { SLOG(LOG_ERROR, TAG_VCM, "@@@ [Manager] Enable Command Type, cmd_type(%d)", cmd_type); + if (VC_COMMAND_TYPE_FOREGROUND > cmd_type || VC_COMMAND_TYPE_EXCLUSIVE < cmd_type) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] cmd type is not valid, (%d)", cmd_type); + return VC_ERROR_INVALID_PARAMETER; + } + vc_state_e state; if (0 != vc_mgr_client_get_client_state(g_vc_m, &state)) { SLOG(LOG_ERROR, TAG_VCM, "[ERROR] A handle is not available"); @@ -684,6 +694,11 @@ int vc_mgr_disable_command_type(int cmd_type) { SLOG(LOG_ERROR, TAG_VCM, "@@@ [Manager] Disable Command Type, cmd_type(%d)", cmd_type); + if (VC_COMMAND_TYPE_FOREGROUND > cmd_type || VC_COMMAND_TYPE_EXCLUSIVE < cmd_type) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] cmd type is not valid, (%d)", cmd_type); + return VC_ERROR_INVALID_PARAMETER; + } + vc_state_e state; if (0 != vc_mgr_client_get_client_state(g_vc_m, &state)) { SLOG(LOG_ERROR, TAG_VCM, "[ERROR] A handle is not available"); @@ -880,8 +895,8 @@ int vc_mgr_set_command_list_from_file(const char* file_path, int type) /* check type */ if (VC_COMMAND_TYPE_FOREGROUND > type || VC_COMMAND_TYPE_EXCLUSIVE < type) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Invalid command type: input type is %d", type); - SLOG(LOG_DEBUG, TAG_VCC, "@@@"); + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Invalid command type: input type is %d", type); + SLOG(LOG_DEBUG, TAG_VCM, "@@@"); return VC_ERROR_INVALID_PARAMETER; } @@ -942,6 +957,13 @@ int vc_mgr_set_preloaded_commands_from_file(const char* file_path) { SLOG(LOG_ERROR, TAG_VCM, "@@@ [Manager] Set preloaded command list"); + if (NULL == file_path) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Invalid parameter, file_path is NULL ptr"); + return VC_ERROR_INVALID_PARAMETER; + } else { + SLOG(LOG_ERROR, TAG_VCM, "@@@ File path: %s", file_path); + } + vc_state_e state; if (0 != vc_mgr_client_get_client_state(g_vc_m, &state)) { SLOG(LOG_ERROR, TAG_VCM, "[ERROR] A handle is not available"); @@ -1334,6 +1356,11 @@ int vc_mgr_get_recognition_mode(vc_recognition_mode_e* mode) { int ret = -1; + if (NULL == mode) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Invalid parameter, mode is NULL ptr"); + return VC_ERROR_INVALID_PARAMETER; + } + ret = vc_mgr_client_get_recognition_mode(g_vc_m, mode); if (0 != ret) { SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to get recognition mode");