From 7e60bf32745b4e0762685588e42fcb550095c7be Mon Sep 17 00:00:00 2001 From: Changseok Oh Date: Sat, 13 Apr 2013 15:26:59 +0900 Subject: [PATCH] fix prevent --- plugin/mms_plugin/MmsPluginMessage.cpp | 21 ++------------------- plugin/mms_plugin/MmsPluginStorage.cpp | 4 +++- plugin/sms_plugin/SmsPluginSatHandler.cpp | 2 +- 3 files changed, 6 insertions(+), 21 deletions(-) diff --git a/plugin/mms_plugin/MmsPluginMessage.cpp b/plugin/mms_plugin/MmsPluginMessage.cpp index 069552a..d4b6f98 100755 --- a/plugin/mms_plugin/MmsPluginMessage.cpp +++ b/plugin/mms_plugin/MmsPluginMessage.cpp @@ -441,7 +441,7 @@ MsgMultipart *MmsMakeMultipart(MimeType mimeType, char *szTitleName, char *szOrg MsgMultipart *pMultipart = NULL; if ((pMultipart = MmsAllocMultipart()) == NULL) - goto __CATCH; + return NULL; pMultipart->type.type = mimeType; @@ -475,23 +475,6 @@ MsgMultipart *MmsMakeMultipart(MimeType mimeType, char *szTitleName, char *szOrg pMultipart->pBody->size = MsgGetFileSize(szOrgFilePath); } return pMultipart; - -__CATCH: - - if (pMultipart) { - if (pMultipart->pBody) { - if (pMultipart->pBody->body.pText) { - free(pMultipart->pBody->body.pText); - pMultipart->pBody->body.pText = NULL; - } - free(pMultipart->pBody); - pMultipart->pBody = NULL; - } - free(pMultipart); - pMultipart = NULL; - } - - return NULL; } bool MmsGetTypeByFileName(int *type, char *szFileName) @@ -1309,7 +1292,7 @@ bool MmsMakeMmsData(MmsMsg *pMsg, MMS_MESSAGE_DATA_S *pMmsMsg) { MSG_BEGIN(); - bzero(pMmsMsg, sizeof(pMmsMsg)); + bzero(pMmsMsg, sizeof(MMS_MESSAGE_DATA_S)); pMmsMsg->regionCnt = 0; pMmsMsg->pageCnt = 0; pMmsMsg->attachCnt = 0; diff --git a/plugin/mms_plugin/MmsPluginStorage.cpp b/plugin/mms_plugin/MmsPluginStorage.cpp index f75115d..950896e 100755 --- a/plugin/mms_plugin/MmsPluginStorage.cpp +++ b/plugin/mms_plugin/MmsPluginStorage.cpp @@ -1429,7 +1429,7 @@ msg_error_t MmsPluginStorage::plgGetMmsMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SEN unsigned int nSize = 0; bool bMultipartRelated = false; - bzero(pMmsMsg, sizeof(pMmsMsg)); + bzero(pMmsMsg, sizeof(MMS_MESSAGE_DATA_S)); pMmsMsg->regionCnt = 0; pMmsMsg->pageCnt = 0; pMmsMsg->attachCnt = 0; @@ -1526,9 +1526,11 @@ msg_error_t MmsPluginStorage::plgGetMmsMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SEN return err; FREE_CATCH: + /* if (bMultipartRelated) { MsgMmsReleaseMmsLists(pMmsMsg); } + */ L_CATCH: MSG_DEBUG("MmsPlgUpdateMessage : Update MMS Message Failed"); diff --git a/plugin/sms_plugin/SmsPluginSatHandler.cpp b/plugin/sms_plugin/SmsPluginSatHandler.cpp index 8a933cf..44c33f1 100755 --- a/plugin/sms_plugin/SmsPluginSatHandler.cpp +++ b/plugin/sms_plugin/SmsPluginSatHandler.cpp @@ -169,7 +169,7 @@ void SmsPluginSatHandler::sendSms(void *pData) memset((void*)pkgInfo.szData, 0x00, sizeof(pkgInfo.szData)); memcpy((void*)pkgInfo.szData, tpdu, tpduLen); - pkgInfo.szData[tpduLen] = '\0'; + pkgInfo.szData[tpduLen - 1] = '\0'; pkgInfo.MsgLength = tpduLen; // Set SMSC Address -- 2.7.4