Fix svace defect 27/61427/1
authorSangkoo Kim <sangkoo.kim@samsung.com>
Tue, 8 Mar 2016 01:22:38 +0000 (10:22 +0900)
committerSangkoo Kim <sangkoo.kim@samsung.com>
Tue, 8 Mar 2016 01:22:38 +0000 (10:22 +0900)
Change-Id: Iaa969d214498b8f0ff6cf5332c7613fc26327607

framework/storage-handler/MsgStorageMessage.cpp
mapi/msg_storage.cpp
plugin/sms_plugin/SmsPluginStorage.cpp
utils/MsgVMessage.cpp

index 385cbb96d2f073d8f0576922ee02cd37ae122deb..c65d046a8406444a9bcbc5d5aada37a30807b6ec 100755 (executable)
@@ -1032,6 +1032,7 @@ msg_error_t MsgStoDeleteAllMessageInFolder(msg_folder_id_t folderId, bool bOnlyD
        int listCnt = sizeof(tableList)/sizeof(char *);
        int rowCnt = 0;
        MsgDbHandler *dbHandle = getDbHandle();
+       signed char folder_id;
 
        /* Get conversation ID from Folder */
        memset(sqlQuery, 0x00, sizeof(sqlQuery));
@@ -1103,7 +1104,8 @@ msg_error_t MsgStoDeleteAllMessageInFolder(msg_folder_id_t folderId, bool bOnlyD
        /*** **/
 
        /*** Delete Sim Message In Folder **/
-       if ((unsigned char)folderId >= (unsigned char)MSG_INBOX_ID) {
+       folder_id = (signed char)folderId;
+       if (folder_id >= MSG_INBOX_ID) {
                memset(sqlQuery, 0x00, sizeof(sqlQuery));
 
                snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID FROM %s WHERE FOLDER_ID = %d AND STORAGE_ID = %d",
@@ -1674,7 +1676,8 @@ msg_error_t MsgStoMoveMessageToFolder(msg_message_id_t msgId, msg_folder_id_t de
        err = MsgStoUpdateConversation(dbHandle, convId);
 
        /* update notification */
-       if ((unsigned char)destFolderId != (unsigned char)MSG_SPAMBOX_ID)
+       signed char dest_folder_id = (signed char)destFolderId;
+       if (dest_folder_id != MSG_SPAMBOX_ID)
                MsgRefreshAllNotification(true, false, MSG_ACTIVE_NOTI_TYPE_NONE);
 
        return err;
index eed39bf1e397560ec51b42fd6f20601f5e4ba8d1..b289a8e5e0a13627eb2d83f90c5ab62c92763ac3 100755 (executable)
@@ -617,7 +617,8 @@ EXPORT_API int msg_generate_message(msg_handle_t handle, msg_message_type_t msg_
                return MSG_ERR_INVALID_PARAMETER;
        }
 
-       if ((unsigned char)folder_id >= (unsigned char)MSG_MAX_FOLDER_ID) {
+       signed char folderId = (signed char)folder_id;
+       if (folderId >= MSG_MAX_FOLDER_ID) {
                MSG_DEBUG("folderId is invalid [%d]", folder_id);
                return MSG_ERR_INVALID_PARAMETER;
        }
index dbeba093ed6525f6e0288551dff3081b588d59a2..10b7aeb811dfd072ee833b7022d0241ec14f83b0 100755 (executable)
@@ -638,7 +638,8 @@ msg_error_t SmsPluginStorage::deleteSmsMessage(msg_message_id_t msgId)
 
        dbHandle->endTrans(true);
 
-       if ((unsigned char)folderId == (unsigned char)MSG_INBOX_ID) {
+       signed char folder_id = (signed char)folderId;
+       if (folder_id == MSG_INBOX_ID) {
                msgType.classType = MSG_CLASS_NONE;
 
                /**  Set memory status in SIM */
index 47cab7786c80622b94d4c05d79bc09604e0d1b12..45249083e7e0fa9093af69485717698738e0a08b 100755 (executable)
@@ -764,8 +764,9 @@ static inline int __msgsvc_vmsg_append_origin_address_vcard(MSG_MESSAGE_INFO_S *
        char originAddress[MAX_ADDRESS_VAL_LEN + 1] = {0, };
        bool isDisplayName = false;
 
-       if ((unsigned char)(pMsg->folderId) == (unsigned char)MSG_INBOX_ID) {
-               strcpy(originAddress, pMsg->addressList[0].addressVal);
+       signed char folderId = (signed char)pMsg->folderId;
+       if (folderId == (signed char)MSG_INBOX_ID) {
+               snprintf(originAddress, sizeof(originAddress), "%s", pMsg->addressList[0].addressVal);
        }
 
        needCharset = true; /* as per android */
@@ -822,13 +823,15 @@ static inline int __msgsvc_vmsg_append_recipient_address_vcard(MSG_MESSAGE_INFO_
        MSGSVC_VMSG_APPEND_STR(buf, buf_size, len, MSGSVC_CRLF);
 
        needCharset = true; /* as per android */
+       signed char folderId;
 
        for (int i = 0; i < pMsg->nAddressCnt; ++i) {
                char originAddress[MAX_ADDRESS_VAL_LEN + 1] = {0, };
                bool isDisplayName = false;
 
-               if (pMsg->folderId == MSG_SENTBOX_ID) {
-                       strcpy(originAddress, pMsg->addressList[0].addressVal);
+               folderId = (signed char)pMsg->folderId;
+               if (folderId == MSG_SENTBOX_ID) {
+                       snprintf(originAddress, sizeof(originAddress), "%s", pMsg->addressList[0].addressVal);
                }
 
                if (strlen(originAddress) > 0) {
@@ -1969,7 +1972,7 @@ static inline msg_error_t __msgsvc_vmsg_get_msg(int ver, char *vmsg, MSG_MESSAGE
                                                pMsg->dataSize = strlen(pMsg->msgText);
                                                free(decodedText);
                                        } else {
-                                               strcpy(pMsg->msgText, "");
+                                               pMsg->msgText[0] = '\0';
                                                pMsg->dataSize = 0;
                                        }
                                }