From: Kyeonghun Lee Date: Wed, 19 Apr 2017 11:45:59 +0000 (+0900) Subject: fix svace issues X-Git-Tag: submit/tizen/20170420.093216^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=44f49653b75852a5ccff86eba99ea98ddb7a6508;p=platform%2Fcore%2Fmessaging%2Fmsg-service.git fix svace issues Change-Id: I21e9a36af8cdd8a9868c405d922b041e52912702 Signed-off-by: Kyeonghun Lee --- diff --git a/framework/submit-handler/MsgSubmitHandler.cpp b/framework/submit-handler/MsgSubmitHandler.cpp index 68ff678..a4e2c44 100755 --- a/framework/submit-handler/MsgSubmitHandler.cpp +++ b/framework/submit-handler/MsgSubmitHandler.cpp @@ -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); diff --git a/plugin/mms_plugin/MmsPluginDecode.cpp b/plugin/mms_plugin/MmsPluginDecode.cpp index 6dbed34..2ef8d46 100755 --- a/plugin/mms_plugin/MmsPluginDecode.cpp +++ b/plugin/mms_plugin/MmsPluginDecode.cpp @@ -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] == '.') diff --git a/plugin/mms_plugin/MmsPluginMessage.cpp b/plugin/mms_plugin/MmsPluginMessage.cpp index 44b633b..773e515 100755 --- a/plugin/mms_plugin/MmsPluginMessage.cpp +++ b/plugin/mms_plugin/MmsPluginMessage.cpp @@ -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(); } diff --git a/plugin/sms_plugin/SmsPluginSetting.cpp b/plugin/sms_plugin/SmsPluginSetting.cpp index 9ec7222..cb26e36 100755 --- a/plugin/sms_plugin/SmsPluginSetting.cpp +++ b/plugin/sms_plugin/SmsPluginSetting.cpp @@ -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; diff --git a/plugin/sms_plugin/SmsPluginSimMsg.cpp b/plugin/sms_plugin/SmsPluginSimMsg.cpp index 730d53f..6dbe888 100755 --- a/plugin/sms_plugin/SmsPluginSimMsg.cpp +++ b/plugin/sms_plugin/SmsPluginSimMsg.cpp @@ -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; } } diff --git a/proxy/MsgProxyListener.cpp b/proxy/MsgProxyListener.cpp index d80040a..c66d09a 100755 --- a/proxy/MsgProxyListener.cpp +++ b/proxy/MsgProxyListener.cpp @@ -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);