From 62f6f6383475a2e8615a7654749ca4e685d57689 Mon Sep 17 00:00:00 2001 From: "jin0.kim" Date: Wed, 23 Mar 2016 10:29:38 +0830 Subject: [PATCH] Fixed Svace Review WGID : 48078, 51539, 66983, 67170 Change-Id: I44c0364dfbd44957484dad420fbf65cca57438b0 --- daemon/notifications/noti.c | 9 ++++++--- daemon/preference.c | 5 ++--- daemon/quickpanel-ui.c | 10 +++++++--- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/daemon/notifications/noti.c b/daemon/notifications/noti.c index 413ac1d..4cc5544 100755 --- a/daemon/notifications/noti.c +++ b/daemon/notifications/noti.c @@ -575,11 +575,11 @@ static void _noti_clear_list_all(void) { struct appdata *ad = quickpanel_get_app_data(); - if (s_info.noti_node->table != NULL) { + retif(ad == NULL, , "Invalid parameter!"); + + if (s_info.noti_node != NULL && s_info.noti_node->table != NULL) { g_hash_table_foreach(s_info.noti_node->table, _noti_node_clear_list_cb, ad->list); - } - if (s_info.noti_node != NULL) { quickpanel_noti_node_remove_all(s_info.noti_node); } } @@ -1401,6 +1401,9 @@ HAPI noti_node_item *quickpanel_noti_node_get_first_noti(void) HAPI void quickpanel_noti_closing_trigger_set(void) { struct appdata *ad = quickpanel_get_app_data(); + + retif(ad == NULL, , "invalid parameter"); + quickpanel_noti_listbox_closing_trigger_set(ad->list); } diff --git a/daemon/preference.c b/daemon/preference.c index 5eed343..185b0db 100755 --- a/daemon/preference.c +++ b/daemon/preference.c @@ -161,7 +161,6 @@ HAPI int quickpanel_preference_get(const char *key, char *value) if (_key_validation_check(key) == 1) { _default_file_create(); } - goto END; } else { DBG("get:[%s]", value_r); } @@ -169,7 +168,7 @@ HAPI int quickpanel_preference_get(const char *key, char *value) END: if (value_r != NULL) { - strcpy(value, value_r); + strncpy(value, value_r, strlen(value_r)); ret = QP_OK; } @@ -208,7 +207,7 @@ HAPI int quickpanel_preference_set(const char *key, char *value) ini = iniparser_load(file_path); retif(ini == NULL, QP_FAIL, "failed to load ini file"); - + if (iniparser_set(ini, (char *)key, value) == 0) { ret = QP_OK; } else { diff --git a/daemon/quickpanel-ui.c b/daemon/quickpanel-ui.c index b094639..eab3240 100755 --- a/daemon/quickpanel-ui.c +++ b/daemon/quickpanel-ui.c @@ -798,6 +798,7 @@ static bool _app_create_cb(void *data) pid_t pid; int r; + char err_buf[128] = {0,}; // signal handler struct sigaction act; @@ -806,15 +807,18 @@ static bool _app_create_cb(void *data) int ret = sigemptyset(&act.sa_mask); if (ret < 0) { - ERR("Failed to sigemptyset[%s]", strerror(errno)); + strerror_r(errno, err_buf, sizeof(err_buf)); + ERR("Failed to sigemptyset[%d / %s]", errno, err_buf); } ret = sigaddset(&act.sa_mask, SIGTERM); if (ret < 0) { - ERR("Failed to sigaddset[%s]", strerror(errno)); + strerror_r(errno, err_buf, sizeof(err_buf)); + ERR("Failed to sigaddset[%d / %s]", errno, err_buf); } ret = sigaction(SIGTERM, &act, NULL); if (ret < 0) { - ERR("Failed to sigaction[%s]", strerror(errno)); + strerror_r(errno, err_buf, sizeof(err_buf)); + ERR("Failed to sigaction[%d / %s]", errno, err_buf); } pid = setsid(); -- 2.7.4