From: Ji-hoon Lee Date: Fri, 20 Sep 2019 11:50:29 +0000 (+0900) Subject: Fix defects detected by static analysis tool X-Git-Tag: submit/tizen/20190930.111916~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F54%2F214354%2F1;p=platform%2Fcore%2Fuifw%2Fwakeup-engine-default.git Fix defects detected by static analysis tool Change-Id: Ia6e40f9bef97c20b127393587d4ed3c268e18d6e --- diff --git a/src/multi_assistant_service.c b/src/multi_assistant_service.c index c05726d..773cb7d 100644 --- a/src/multi_assistant_service.c +++ b/src/multi_assistant_service.c @@ -455,8 +455,12 @@ int mas_client_set_preprocessing_allow_mode(int pid, int mode, const char* appid if (g_maclient_info[loop].used) { if (pid_appid && strncmp(pid_appid, g_maclient_info[loop].appid, MAX_APPID_LEN) == 0) { g_maclient_info[loop].preprocessing_allow_mode = mode; - strncpy(g_maclient_info[loop].preprocessing_allow_appid, appid, MAX_APPID_LEN); - g_maclient_info[loop].preprocessing_allow_appid[MAX_APPID_LEN - 1] = '\0'; + if (appid) { + strncpy(g_maclient_info[loop].preprocessing_allow_appid, appid, MAX_APPID_LEN); + g_maclient_info[loop].preprocessing_allow_appid[MAX_APPID_LEN - 1] = '\0'; + } else { + g_maclient_info[loop].preprocessing_allow_appid[0] = '\0'; + } } } } @@ -1018,7 +1022,7 @@ int mas_process_voice_key_event(bool pressed) ma_preprocessing_allow_mode_e get_preprocessing_allow_mode(const char* appid) { for (int loop = 0; loop < MAX_MACLIENT_INFO_NUM; loop++) { - if (g_maclient_info[loop].used) { + if (appid && g_maclient_info[loop].used) { if (strncmp(appid, g_maclient_info[loop].appid, MAX_APPID_LEN) == 0) { return g_maclient_info[loop].preprocessing_allow_mode; }