From: Hwankyu Jhun Date: Mon, 22 Feb 2021 02:47:29 +0000 (+0900) Subject: Fix arguments check of component port API X-Git-Tag: submit/tizen/20210222.030137~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1f197ce2c4f787b31e0cb3e314b27423b24f2699;p=platform%2Fcore%2Fappfw%2Fcomponent-based-application.git Fix arguments check of component port API Change-Id: Ic58c14d18a2dccd870ab3e2b5381bc30948bee8e Signed-off-by: Hwankyu Jhun --- diff --git a/component_based/port/stub.cc b/component_based/port/stub.cc index 6d6bbb5..2e8f62c 100644 --- a/component_based/port/stub.cc +++ b/component_based/port/stub.cc @@ -182,7 +182,7 @@ PortWatcherStub port_watcher; extern "C" EXPORT_API int component_port_create(const char* port_name, component_port_h* port) { - if (port_name == nullptr || port == nullptr) { + if (port_name == nullptr || strlen(port_name) == 0 || port == nullptr) { _E("Invalid parameter"); return COMPONENT_PORT_ERROR_INVALID_PARAMETER; } @@ -241,7 +241,7 @@ extern "C" EXPORT_API int component_port_set_sync_request_cb( extern "C" EXPORT_API int component_port_add_privilege(component_port_h port, const char *privilege) { - if (port == nullptr || privilege == nullptr) { + if (port == nullptr || privilege == nullptr || strlen(privilege) == 0) { _E("Invalid parameter"); return COMPONENT_PORT_ERROR_INVALID_PARAMETER; } @@ -280,7 +280,8 @@ extern "C" EXPORT_API void component_port_cancel(component_port_h port) { extern "C" EXPORT_API int component_port_send(component_port_h port, const char *endpoint, int timeout, parcel_h request) { - if (port == nullptr || endpoint == nullptr || request == nullptr) { + if (port == nullptr || endpoint == nullptr || request == nullptr || + strlen(endpoint) == 0) { _E("Invalid parameter"); return COMPONENT_PORT_ERROR_INVALID_PARAMETER; } @@ -306,7 +307,7 @@ extern "C" EXPORT_API int component_port_send(component_port_h port, extern "C" EXPORT_API int component_port_send_sync(component_port_h port, const char *endpoint, int timeout, parcel_h request, parcel_h *response) { if (port == nullptr || endpoint == nullptr || request == nullptr || - response == nullptr) { + response == nullptr || strlen(endpoint) == 0) { _E("Invalid parameter"); return COMPONENT_PORT_ERROR_INVALID_PARAMETER; } @@ -338,7 +339,7 @@ extern "C" EXPORT_API int component_port_send_sync(component_port_h port, extern "C" EXPORT_API int component_port_is_running(const char* endpoint, bool* is_running) { - if (endpoint == nullptr || is_running == nullptr) { + if (endpoint == nullptr || is_running == nullptr || strlen(endpoint) == 0) { _E("Invalid parameter"); return COMPONENT_PORT_ERROR_INVALID_PARAMETER; } @@ -359,7 +360,7 @@ extern "C" EXPORT_API int component_port_watch(const char *endpoint, void* user_data, unsigned int* watcher_id) { if (endpoint == nullptr || appeared_cb == nullptr || vanished_cb == nullptr || - watcher_id == nullptr) { + watcher_id == nullptr || strlen(endpoint) == 0) { _E("Invalid parameter"); return COMPONENT_PORT_ERROR_INVALID_PARAMETER; }