[SVACE Issue Fixes] 45/173445/3 accepted/tizen/unified/20180423.062803 submit/tizen/20180420.070349
authorAbhishek Vijay <abhishek.v@samsung.com>
Wed, 21 Mar 2018 12:14:38 +0000 (17:44 +0530)
committerAbhishek Vijay <abhishek.v@samsung.com>
Fri, 20 Apr 2018 06:11:28 +0000 (11:41 +0530)
Change-Id: I69fcc719ac4949da42d5e6f52fcfc06abc8cf6c6
Signed-off-by: Abhishek Vijay <abhishek.v@samsung.com>
framework/storage-handler/MsgStorageManager.cpp
utils/MsgUtilFunction.cpp
utils/MsgUtilStorage.cpp

index 8eaf0da..f81d0e2 100755 (executable)
@@ -1076,7 +1076,7 @@ msg_error_t MsgStoRestoreMessage(const char *filepath, msg_id_list_s **result_id
                        msgIdList->msgIdList = (msg_message_id_t*)calloc(1, sizeof(msg_message_id_t));
                        if (msgIdList->msgIdList == NULL) {
                                MSG_DEBUG("calloc failed");
-                               err = MSG_ERR_UNKNOWN;
+                               err =  MSG_ERR_NULL_POINTER;
                                goto __RETURN;
                        }
                } else {
index 0883576..e26b08d 100755 (executable)
@@ -552,25 +552,25 @@ int MsgEncodeThreadInfo(MSG_THREAD_VIEW_S *pThreadInfo, char **ppDest)
 /* Decoders */
 void MsgDecodeMsgId(char *pSrc, msg_message_id_t *pMsgId)
 {
-       memcpy(pMsgId, pSrc, sizeof(msg_message_id_t));
+       memcpy(pMsgId, pSrc, sizeof(char)*2);
 }
 
 
 void MsgDecodeCountInfo(char *pSrc, MSG_COUNT_INFO_S *pCountInfo)
 {
-       memcpy(pCountInfo, pSrc, sizeof(MSG_COUNT_INFO_S));
+       memcpy(pCountInfo, pSrc, sizeof(char)*2);
 }
 
 
 void MsgDecodeMemSize(char *pSrc, unsigned int *memsize)
 {
-       memcpy(memsize, pSrc, sizeof(unsigned int));
+       memcpy(memsize, pSrc, sizeof(char)*2);
 }
 
 
 void MsgDecodeMsgInfo(char *pSrc, MSG_MESSAGE_INFO_S *pMsgInfo)
 {
-       memcpy(pMsgInfo, pSrc, sizeof(MSG_MESSAGE_INFO_S));
+       memcpy(pMsgInfo, pSrc, sizeof(char)*2);
 
        pSrc = pSrc + sizeof(MSG_MESSAGE_INFO_S);
 
@@ -587,7 +587,7 @@ void MsgDecodeMsgInfo(char *pSrc, MSG_MESSAGE_INFO_S *pMsgInfo)
 
 void MsgDecodeMsgInfo(char *pSrc, MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S* pSendOptInfo)
 {
-       memcpy(pMsgInfo, pSrc, sizeof(MSG_MESSAGE_INFO_S));
+       memcpy(pMsgInfo, pSrc, sizeof(char)*2);
 
        pSrc = pSrc + sizeof(MSG_MESSAGE_INFO_S);
 
@@ -632,7 +632,7 @@ void MsgDecodeFolderList(char *pSrc, msg_struct_list_s *pFolderList)
 {
        int count = 0;
 
-       memcpy(&count, pSrc, sizeof(int));
+       memcpy(&count, pSrc, sizeof(char)*2);
        pSrc = pSrc + sizeof(int);
 
        if( count > 0 ) {
@@ -711,22 +711,22 @@ void      MsgDecodeContactCount(char *pSrc,  MSG_THREAD_COUNT_INFO_S *pMsgThreadCount
        if(pSrc == NULL)
                return;
 
-       memcpy(&count, pSrc, sizeof(int));
+       memcpy(&count, pSrc, sizeof(char)*2);
        pSrc = pSrc + sizeof(int);
        pMsgThreadCountList->totalCount = count;
 
 
-       memcpy(&count, pSrc, sizeof(int));
+       memcpy(&count, pSrc, sizeof(char)*2);
        pSrc = pSrc + sizeof(int);
        pMsgThreadCountList->unReadCount        = count;
 
 
-       memcpy(&count, pSrc, sizeof(int));
+       memcpy(&count, pSrc, sizeof(char)*2);
        pSrc = pSrc + sizeof(int);
        pMsgThreadCountList->mmsMsgCount        = count;
 
 
-       memcpy(&count, pSrc, sizeof(int));
+       memcpy(&count, pSrc, sizeof(char)*2);
        pSrc = pSrc + sizeof(int);
        pMsgThreadCountList->smsMsgCount        = count;
 
@@ -742,7 +742,7 @@ void MsgDecodeReportStatus(char *pSrc,  msg_struct_list_s *report_list)
        if(pSrc == NULL)
                return;
 
-       memcpy(&count, pSrc, sizeof(int));
+       memcpy(&count, pSrc, sizeof(char)*2);
        pSrc = pSrc + sizeof(int);
 
        report_list->nCount = count;
@@ -772,12 +772,12 @@ void MsgDecodeReportStatus(char *pSrc,  msg_struct_list_s *report_list)
 
 void MsgDecodeThreadId(char *pSrc, msg_thread_id_t *pThreadId)
 {
-       memcpy(pThreadId, pSrc, sizeof(msg_thread_id_t));
+       memcpy(pThreadId, pSrc, sizeof(char)*2);
 }
 
 void MsgDecodeThreadInfo(char *pSrc, MSG_THREAD_VIEW_S *pThreadInfo)
 {
-       memcpy(pThreadInfo, pSrc, sizeof(MSG_THREAD_VIEW_S));
+       memcpy(pThreadInfo, pSrc, sizeof(char)*2);
 }
 
 /* Event Encoder */
index 8da7f11..0f2e607 100755 (executable)
@@ -2127,7 +2127,8 @@ msg_error_t MsgStoGetConversationViewItem(msg_message_id_t msgId, MSG_CONVERSATI
        if (pConv->bRestricted == true) {
                pConv->textSize = 0;
                memset(pConv->subject, 0x00, sizeof(pConv->subject));
-               tmpText[0] = '\0';
+               if (tmpText)
+                       tmpText[0] = '\0';
        }
 
        pConv->simIndex = dbHandle->getColumnToInt(index++);
@@ -2260,7 +2261,8 @@ msg_error_t MsgStoGetConversationViewList(msg_thread_id_t threadId, msg_struct_l
                if (pTmp->bRestricted == true) {
                        pTmp->textSize = 0;
                        memset(pTmp->subject, 0x00, sizeof(pTmp->subject));
-                       tmpText[i][0] = '\0';
+                       if (tmpText[i])
+                               tmpText[i][0] = '\0';
                }
                pTmp->simIndex = dbHandle->getColumnToInt(index++);
        }