Svace error fixed 11/63711/1
authorSang-Hun Chung <sanghun.chung@samsung.com>
Fri, 25 Mar 2016 09:06:09 +0000 (18:06 +0900)
committerSang-Hun Chung <sanghun.chung@samsung.com>
Fri, 25 Mar 2016 09:06:09 +0000 (18:06 +0900)
Change-Id: Iafac92474a76db75df9dc71dfdaf064a0897cd8f
Signed-off-by: Sang-Hun Chung <sanghun.chung@samsung.com>
email-core/email-core-imap-idle.c
email-core/email-core-mailbox-sync.c
email-core/email-core-smtp.c
email-core/email-core-utils.c
email-core/email-storage/email-storage.c
email-ipc/email-socket/email-ipc-socket.c

index f0713a5..45fbd3d 100755 (executable)
@@ -494,7 +494,7 @@ void* emcore_imap_idle_worker(void* thread_user_data)
        epoll_fd = epoll_create(MAX_EPOLL_EVENT);
 
        if (epoll_fd < 0) {
-               EM_DEBUG_CRITICAL_EXCEPTION("epoll_create failed: %s[%d]", EM_STRERROR(errno_buf), errno);
+               EM_DEBUG_CRITICAL_EXCEPTION("epoll_create failed: [%d]", errno);
                err = EMAIL_ERROR_IMAP4_IDLE_FAILURE;
                goto FINISH_OFF;
        }
index ee3d89c..604655c 100755 (executable)
@@ -595,7 +595,7 @@ int emcore_get_uids_order_by_datetime_from_imap_server(MAILSTREAM *stream, int c
                        SNPRINTF(command, sizeof(command), "%s UID SEARCH 1:* SINCE %s\015\012", tag, since_date_string);
                EM_DEBUG_LOG("COMMAND [%s] ", command);
 
-               EM_SAFE_STRCPY(before_date_string, since_date_string);
+               g_strlcpy(before_date_string, since_date_string, 20);
                EM_SAFE_FREE(since_date_string);
 #ifdef FEATURE_CORE_DEBUG
                EM_DEBUG_LOG(" [IMAP4] >>> [%s]", command);
@@ -734,8 +734,8 @@ int imap4_mailbox_get_uids_by_timestamp(MAILSTREAM *stream, emcore_uid_list** ui
        time(&RawTime);
 
        EM_DEBUG_LOG("RawTime Info [%lu]", RawTime);
-
-       timeinfo = localtime(&RawTime);
+       struct tm time_buf;
+       timeinfo = localtime_r(&RawTime, &time_buf);
        if (timeinfo == NULL) {
                EM_DEBUG_EXCEPTION("localtime failed");
                err = EMAIL_ERROR_SYSTEM_FAILURE;
@@ -3171,7 +3171,8 @@ INTERNAL_FUNC char *emcore_guess_charset(char *multi_user_name, char *source_str
        }
 
        time_t t = time(0);
-       struct tm *data = localtime(&t);
+       struct tm time_buf;
+       struct tm *data = localtime_r(&t, &time_buf);
        if (data == NULL) {
                EM_DEBUG_EXCEPTION("localtime failed");
                return NULL;
index c3dc2f5..8c5093a 100755 (executable)
@@ -3621,7 +3621,8 @@ static int emcore_make_envelope_from_mail(char *multi_user_name, emstorage_mail_
                int zone      = t->tm_hour * 60 + t->tm_min;
                int julian    = t->tm_yday;
 
-               t = localtime(&input_mail_tbl_data->date_time);
+               struct tm t_buf;
+               t = localtime_r(&input_mail_tbl_data->date_time, &t_buf);
                if (t == NULL) {
                        EM_DEBUG_EXCEPTION("localtime failed");
                        error = EMAIL_ERROR_SYSTEM_FAILURE;
index 4d80815..75d400a 100755 (executable)
@@ -4081,6 +4081,7 @@ static int emcore_get_next_peak_start_time(emstorage_account_tbl_t *input_accoun
        int day_count = 0;
        int start_hour = 0;
        int start_min  = 0;
+       struct tm time_buf;
        struct tm *time_info;
 
        if (output_time == NULL) {
@@ -4089,7 +4090,7 @@ static int emcore_get_next_peak_start_time(emstorage_account_tbl_t *input_accoun
                goto FINISH_OFF;
        }
 
-       time_info = localtime(&input_current_time);
+       time_info = localtime_r(&input_current_time, &time_buf);
        if (time_info == NULL) {
                EM_DEBUG_EXCEPTION("localtime failed");
                err = EMAIL_ERROR_SYSTEM_FAILURE;
@@ -4149,6 +4150,7 @@ static int emcore_check_time_in_peak_schedule(emstorage_account_tbl_t *input_acc
 {
        EM_DEBUG_FUNC_BEGIN("input_account_ref [%p] input_time[%d] output_result[%p]", input_account_ref, input_time, output_result);
        int err = EMAIL_ERROR_NONE;
+       struct tm time_buf;
        struct tm *time_info;
        int wday = 1;
        int result = 0;
@@ -4163,7 +4165,7 @@ static int emcore_check_time_in_peak_schedule(emstorage_account_tbl_t *input_acc
                goto FINISH_OFF;
        }
 
-       time_info = localtime(&input_time);
+       time_info = localtime_r(&input_time, &time_buf);
        if (time_info == NULL) {
                EM_DEBUG_EXCEPTION("localtime failed");
                err = EMAIL_ERROR_SYSTEM_FAILURE;
@@ -5450,13 +5452,14 @@ INTERNAL_FUNC int emcore_make_date_string_for_search(time_t input_time, char **o
 {
        EM_DEBUG_FUNC_BEGIN("input_time[%p] output_date_string[%p]", input_time, output_date_string);
        int err = EMAIL_ERROR_NONE;
-       struct tm   *timeinfo = NULL;
+       struct tm time_buf;
+       struct tm   *timeinfo;
        char *mon = NULL;
        char *temp_date_string = NULL;
 
        EM_DEBUG_LOG("RawTime Info [%lu]", input_time);
 
-       timeinfo = localtime(&input_time);
+       timeinfo = localtime_r(&input_time, &time_buf);
        if (timeinfo == NULL) {
                EM_DEBUG_EXCEPTION("localtime failed");
                err = EMAIL_ERROR_SYSTEM_FAILURE;
index c1ed451..8ffa1b5 100755 (executable)
@@ -4037,11 +4037,11 @@ static int _get_password_file_name(char *multi_user_name, int account_id, char *
     EM_DEBUG_LOG("MULTI_USER_NAME : [%s]", multi_user_name);
 
        if (EM_SAFE_STRLEN(multi_user_name) > 0) {
-               sprintf(recv_password_file_name, ".email_account_%d_recv_%s", account_id, multi_user_name);
-               sprintf(send_password_file_name, ".email_account_%d_send_%s", account_id, multi_user_name);
+               snprintf(recv_password_file_name, MAX_PW_FILE_NAME_LENGTH, ".email_account_%d_recv_%s", account_id, multi_user_name);
+               sprintf(send_password_file_name, MAX_PW_FILE_NAME_LENGTH, ".email_account_%d_send_%s", account_id, multi_user_name);
        } else {
-               sprintf(recv_password_file_name, ".email_account_%d_recv", account_id);
-               sprintf(send_password_file_name, ".email_account_%d_send", account_id);
+               sprintf(recv_password_file_name, MAX_PW_FILE_NAME_LENGTH, ".email_account_%d_recv", account_id);
+               sprintf(send_password_file_name, MAX_PW_FILE_NAME_LENGTH, ".email_account_%d_send", account_id);
        }
 
        EM_DEBUG_FUNC_END();
@@ -11569,14 +11569,14 @@ INTERNAL_FUNC int emstorage_get_save_name(char *multi_user_name, int account_id,
                goto FINISH_OFF;
        }
 
-       sprintf(path_buf, "%s", MAILHOME);
-       sprintf(path_buf+EM_SAFE_STRLEN(path_buf), "%s%d", DIR_SEPERATOR, account_id);
+       snprintf(path_buf, 512, "%s", MAILHOME);
+       snprintf(path_buf+EM_SAFE_STRLEN(path_buf), 512 - EM_SAFE_STRLEN(path_buf), "%s%d", DIR_SEPERATOR, account_id);
 
        if (mail_id > 0)
-               sprintf(path_buf+EM_SAFE_STRLEN(path_buf), "%s%d", DIR_SEPERATOR, mail_id);
+               snprintf(path_buf+EM_SAFE_STRLEN(path_buf),   512 - EM_SAFE_STRLEN(path_buf), "%s%d", DIR_SEPERATOR, mail_id);
 
        if (atch_id > 0)
-               sprintf(path_buf+EM_SAFE_STRLEN(path_buf), "%s%d", DIR_SEPERATOR, atch_id);
+               snprintf(path_buf+EM_SAFE_STRLEN(path_buf), 512 - EM_SAFE_STRLEN(path_buf), "%s%d", DIR_SEPERATOR, atch_id);
 
        if (fname) {
                temp_file = EM_SAFE_STRDUP(fname);
@@ -11674,6 +11674,7 @@ FINISH_OFF:
        return ret;
 }
 
+/*
 INTERNAL_FUNC int emstorage_get_dele_name(char *multi_user_name, int account_id, int mail_id, int atch_id, char *fname, char *name_buf, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], mail_id[%d], atch_id[%d], fname[%p], name_buf[%p], err_code[%p]", account_id, mail_id, atch_id, fname, name_buf, err_code);
@@ -11703,6 +11704,7 @@ FINISH_OFF:
        EM_DEBUG_FUNC_END();
        return true;
 }
+*/
 
 INTERNAL_FUNC int emstorage_create_dir(char *multi_user_name, int account_id, int mail_id, int atch_id, int *err_code)
 {
index 085e4c8..f692a18 100755 (executable)
@@ -296,7 +296,7 @@ EXPORT_API int emipc_connect_email_socket(int fd)
 
        memset(&server, 0, sizeof(server));
        server.sun_family = AF_UNIX;
-       strcpy(server.sun_path, ipc_socket_path);
+       strncpy(server.sun_path, ipc_socket_path, sizeof(server.sun_path)-1);
 
        EM_SAFE_FREE(ipc_socket_path);