fix svace issues 61/125961/2 accepted/tizen/unified/20170420.155752 submit/tizen/20170420.093216
authorKyeonghun Lee <kh9090.lee@samsung.com>
Wed, 19 Apr 2017 11:45:59 +0000 (20:45 +0900)
committerKyeonghun Lee <kh9090.lee@samsung.com>
Thu, 20 Apr 2017 07:52:02 +0000 (16:52 +0900)
Change-Id: I21e9a36af8cdd8a9868c405d922b041e52912702
Signed-off-by: Kyeonghun Lee <kh9090.lee@samsung.com>
framework/submit-handler/MsgSubmitHandler.cpp
plugin/mms_plugin/MmsPluginDecode.cpp
plugin/mms_plugin/MmsPluginMessage.cpp
plugin/sms_plugin/SmsPluginSetting.cpp
plugin/sms_plugin/SmsPluginSimMsg.cpp
proxy/MsgProxyListener.cpp

index 68ff678..a4e2c44 100755 (executable)
@@ -104,10 +104,11 @@ msg_error_t MsgSubmitReqSMS(MSG_REQUEST_INFO_S *pReqInfo)
        if (pReqInfo->msgInfo.msgPort.valid == false) {
                pReqInfo->msgInfo.folderId = MSG_OUTBOX_ID;
 
-               if (pReqInfo->msgInfo.msgId > 0 && (pReqInfo->msgInfo.folderId == MSG_DRAFT_ID || pReqInfo->msgInfo.folderId == MSG_OUTBOX_ID))
+               if (pReqInfo->msgInfo.msgId > 0 && (pReqInfo->msgInfo.folderId == MSG_DRAFT_ID || pReqInfo->msgInfo.folderId == MSG_OUTBOX_ID)) {
                        err = MsgStoUpdateMessage(&(pReqInfo->msgInfo), &(pReqInfo->sendOptInfo));
                        if (err != MSG_SUCCESS)
                                return err;
+               }
        }
 
        err = plg->submitReq(pReqInfo);
index 6dbed34..2ef8d46 100755 (executable)
@@ -5613,7 +5613,7 @@ static bool __MmsMultipartSaveAsTempFile(MsgType *pPartType, MsgBody *pPartBody,
                /* IF DRM type check dcf exist */
                if (pPartType->type == MIME_APPLICATION_VND_OMA_DRM_MESSAGE
                        || pPartType->type == MIME_APPLICATION_VND_OMA_DRM_CONTENT) {
-                       char destDrmPath[MSG_FILEPATH_LEN_MAX] = {0, };
+                       char destDrmPath[MSG_FILEPATH_LEN_MAX + 1] = {0, };
 
                        MsgGetFileNameWithoutExtension(destDrmPath, pPartBody->szOrgFilePath);
                        strncat(destDrmPath, ".dcf", 4);
@@ -5943,6 +5943,7 @@ bool MsgGetFileNameWithoutExtension(char *szOutputName, char *szName)
        }
 
        strncpy(szOutputName, szName, strlen(szName));
+       szOutputName[strlen(szName)] = '\0';
 
        if ((pszExt = strrchr(szOutputName, '.'))) {
                if (pszExt[0] == '.')
index 44b633b..773e515 100755 (executable)
@@ -311,7 +311,9 @@ void MmsComposeNotiMessage(MmsMsg *pMmsMsg, msg_message_id_t msgID)
        }
 
        strncpy(pMmsMsg->mmsAttrib.szSubject, mmsHeader.szSubject, MSG_LOCALE_SUBJ_LEN);
+       pMmsMsg->mmsAttrib.szSubject[MSG_LOCALE_SUBJ_LEN] = '\0';
        strncpy(pMmsMsg->szContentLocation, mmsHeader.szContentLocation, MMS_LOCATION_LEN);
+       pMmsMsg->szContentLocation[MMS_LOCATION_LEN] = '\0';
 
        pMmsMsg->mmsAttrib.msgClass = mmsHeader.msgClass;
        pMmsMsg->mmsAttrib.msgSize = mmsHeader.msgSize;
@@ -327,6 +329,7 @@ void MmsComposeNotiMessage(MmsMsg *pMmsMsg, msg_message_id_t msgID)
        pMmsMsg->mmsAttrib.replyCharge.chargeSize = mmsHeader.replyCharge.chargeSize;
 
        strncpy(pMmsMsg->mmsAttrib.replyCharge.szChargeID, mmsHeader.replyCharge.szChargeID, MMS_MSG_ID_LEN);
+       pMmsMsg->mmsAttrib.replyCharge.szChargeID[MMS_MSG_ID_LEN] = '\0';
 
        MSG_END();
 }
index 9ec7222..cb26e36 100755 (executable)
@@ -59,7 +59,6 @@ SmsPluginSetting::SmsPluginSetting()
 {
        /* Initialize member variables */
        for (int i = 0; i <= MAX_TELEPHONY_HANDLE_CNT; i++) {
-               memset(&smscData[i], 0x00, sizeof(MSG_SMSC_DATA_S));
                simStatus[i] = MSG_SIM_STATUS_NOT_FOUND;
        }
        smscList.clear();
@@ -67,6 +66,7 @@ SmsPluginSetting::SmsPluginSetting()
        simMwiInfo.clear();
        cbOpt.clear();
        memset(&meImei, 0x00, sizeof(meImei));
+       memset(&smscData, 0x00, sizeof(smscData));
 
        bTapiResult = false;
        paramCnt = 0;
index 730d53f..6dbe888 100755 (executable)
@@ -444,6 +444,15 @@ msg_error_t SmsPluginSimMsg::saveClass2Message(const MSG_MESSAGE_INFO_S *pMsgInf
 
                                SmsPluginTransport::instance()->sendDeliverReport(handle, MSG_ERR_STORAGE_ERROR);
 
+                               if (tmpSimMsgInfo) {
+                                       if (tmpSimMsgInfo->addressList) {
+                                               delete[] tmpSimMsgInfo->addressList;
+                                               tmpSimMsgInfo->addressList = NULL;
+                                       }
+                                       free(tmpSimMsgInfo);
+                                       tmpSimMsgInfo = NULL;
+                               }
+
                                return MSG_ERR_PLUGIN_STORAGE;
                        }
                }
index d80040a..c66d09a 100755 (executable)
@@ -155,10 +155,10 @@ MsgProxyListener* MsgProxyListener::instance()
 
 void MsgProxyListener::start(MsgHandle* pMsgHandle)
 {
-       MsgMutexLocker lock(mx);
-
        this->insertOpenHandleSet(pMsgHandle);
 
+       MsgMutexLocker lock(mx);
+
        if (running == 0) {
                cliSock.connect(MSG_SOCKET_PATH);