Correct to check return of fread
[platform/core/uifw/stt.git] / client / stt.c
index 2035dea..8a55d34 100644 (file)
@@ -105,7 +105,7 @@ static bool __check_privilege(const char* uid, const char * privilege)
 
        fp = fopen(label_path, "r");
        if (fp != NULL) {
-               if (sizeof(smack_label) != fread(smack_label, 1, sizeof(smack_label), fp))
+               if (0 >= fread(smack_label, 1, sizeof(smack_label), fp))
                        SLOG(LOG_ERROR, TAG_STTC, "[ERROR] fail to fread");
 
                fclose(fp);
@@ -1042,7 +1042,7 @@ int stt_prepare(stt_h stt)
                return STT_ERROR_INVALID_STATE;
        }
 
-       g_connect_timer = ecore_timer_add(0, __stt_connect_daemon, (void*)client);
+       g_connect_timer = ecore_timer_add(0.02, __stt_connect_daemon, (void*)client);
 
        SLOG(LOG_DEBUG, TAG_STTC, "=====");
        SLOG(LOG_DEBUG, TAG_STTC, " ");
@@ -1617,8 +1617,8 @@ int stt_start(stt_h stt, const char* language, const char* type)
        }
 
        int ret = -1;
-       char appid[128] = {0, };
-       ret = aul_app_get_appid_bypid(getpid(), appid, sizeof(appid));
+       char appid[1024] = {0, };
+       ret = aul_app_get_appid_bypid(getpid(), appid, sizeof(appid) - 1);
 
        if ((AUL_R_OK != ret) || (0 == strlen(appid))) {
                SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to get application ID");
@@ -2094,12 +2094,12 @@ int __stt_cb_result(int uid, int event, char** data, int data_count, const char*
        }
 
        if (NULL != msg)
-               SLOG(LOG_DEBUG, TAG_STTC, "Recognition Result Message = %s", msg);
+               SECURE_SLOG(LOG_DEBUG, TAG_STTC, "Recognition Result Message = %s", msg);
 
        int i = 0;
        for (i = 0; i < data_count; i++) {
                if (NULL != data[i])
-                       SLOG(LOG_DEBUG, TAG_STTC, "Recognition Result[%d] = %s", i, data[i]);
+                       SECURE_SLOG(LOG_DEBUG, TAG_STTC, "Recognition Result[%d] = %s", i, data[i]);
        }
 
        if (NULL != client->recognition_result_cb) {
@@ -2535,8 +2535,8 @@ int stt_start_file(stt_h stt, const char* language, const char* type, const char
        }
 
        int ret = -1;
-       char appid[128] = {0, };
-       ret = aul_app_get_appid_bypid(getpid(), appid, sizeof(appid));
+       char appid[1024] = {0, };
+       ret = aul_app_get_appid_bypid(getpid(), appid, sizeof(appid) - 1);
 
        if ((AUL_R_OK != ret) || (0 == strlen(appid))) {
                SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to get application ID");