Fix potential defects detected by static analysis tool 28/319828/1
authorurmain <wn.jang@samsung.com>
Fri, 1 Nov 2024 09:08:02 +0000 (18:08 +0900)
committerurmain <wn.jang@samsung.com>
Mon, 4 Nov 2024 02:50:27 +0000 (11:50 +0900)
Change-Id: I67394bfd74758d9a56592ef6134e0e5f3887dfb7

common/tts_config_mgr.c
server/ttsd_engine_agent.c

index 21bfdd5fd2e070b4e9ec57a69aab520d31ea9996..82df9e2b6316fa7237ec4440b708cce0d2e72778 100644 (file)
@@ -2560,7 +2560,7 @@ int tts_config_mgr_check_duplicate_personal_voice(const char* engine_id, const c
                        personal_voice = iter_personal_voice->data;
 
                        SLOG(LOG_DEBUG, TAG_TTSCONFIG, "  [%dth] unique_id(%s)", j, personal_voice->unique_id);
-                       if (0 == strncmp(unique_id, personal_voice->unique_id, strlen(unique_id))) {
+                       if (0 == strncmp(unique_id, personal_voice->unique_id, strlen(unique_id) + 1)) {
                                *matched = true;
                                break;
                        }
index 6f8e55daa71262602af8e9a9a4db77b3f7430a68..5964628d45fd3991577443379827a11ac6cd0504 100644 (file)
@@ -663,11 +663,11 @@ bool ttsd_engine_select_valid_voice(const char* lang, int type, const char* ptts
                                /* Get handle data from list */
                                voice = iter->data;
 
-                               if (0 == strncmp(voice->language, g_engine_info->default_lang, strlen(g_engine_info->default_lang))) {
+                               if (0 == strncmp(voice->language, g_engine_info->default_lang, strlen(g_engine_info->default_lang) + 1)) {
                                        voice_selected = voice;
                                        if (voice->type == type) {
                                                if (type == TTSE_VOICE_TYPE_PERSONAL && NULL != ptts_id) {
-                                                       if (0 != strncmp(voice->ptts_id, ptts_id, strlen(voice->ptts_id))) {
+                                                       if (0 != strncmp(voice->ptts_id, ptts_id, strlen(voice->ptts_id) + 1)) {
                                                                iter = g_list_next(iter);
                                                                continue;
                                                        }