diff options
author | kamaljeet chauhan <kamal.jc@samsung.com> | 2020-01-16 11:20:21 +0530 |
---|---|---|
committer | kamaljeet chauhan <kamal.jc@samsung.com> | 2020-01-16 11:57:22 +0530 |
commit | 5354d27918763133c7c253fd62172635681fc491 (patch) | |
tree | e633f5530000020be3fd761f0a15e6c6d6baf77c | |
parent | 290f7542ac2ed95dd7a197254727b5a11a1a2f00 (diff) | |
download | msg-service-5354d27918763133c7c253fd62172635681fc491.tar.gz msg-service-5354d27918763133c7c253fd62172635681fc491.tar.bz2 msg-service-5354d27918763133c7c253fd62172635681fc491.zip |
Changes related to Enable build with GCC 9.2submit/tizen/20200116.072409accepted/tizen/unified/20200116.124230
Change-Id: I6e9779d46b6f3d5ea5acf5892b29d08c71dc8ca5
Signed-off-by: kamaljeet chauhan <kamal.jc@samsung.com>
-rwxr-xr-x | framework/storage-handler/MsgStorageMessage.cpp | 16 | ||||
-rwxr-xr-x | framework/submit-handler/MsgSubmitHandler.cpp | 4 | ||||
-rw-r--r-- | manager/src/msg-manager-notification.cpp | 106 | ||||
-rwxr-xr-x | mapi/msg_mms.cpp | 4 | ||||
-rwxr-xr-x | plugin/mms_plugin/MmsPluginAppBase.cpp | 9 | ||||
-rwxr-xr-x | plugin/mms_plugin/MmsPluginDecode.cpp | 90 | ||||
-rwxr-xr-x | plugin/mms_plugin/MmsPluginEncode.cpp | 17 | ||||
-rwxr-xr-x | plugin/mms_plugin/MmsPluginHttp.cpp | 33 | ||||
-rwxr-xr-x | plugin/mms_plugin/MmsPluginInternal.cpp | 40 | ||||
-rwxr-xr-x | plugin/mms_plugin/MmsPluginMessage.cpp | 199 | ||||
-rwxr-xr-x | plugin/mms_plugin/MmsPluginStorage.cpp | 17 | ||||
-rwxr-xr-x | plugin/mms_plugin/MmsPluginUserAgent.cpp | 5 | ||||
-rwxr-xr-x | plugin/sms_plugin/SmsPluginSatHandler.cpp | 4 | ||||
-rwxr-xr-x | plugin/sms_plugin/SmsPluginWapPushHandler.cpp | 21 | ||||
-rwxr-xr-x | utils/MsgMmsMessage.cpp | 4 | ||||
-rwxr-xr-x | utils/MsgSmil.cpp | 8 | ||||
-rwxr-xr-x | utils/MsgUtilStorage.cpp | 13 | ||||
-rwxr-xr-x | utils/MsgVMessage.cpp | 37 |
18 files changed, 471 insertions, 156 deletions
diff --git a/framework/storage-handler/MsgStorageMessage.cpp b/framework/storage-handler/MsgStorageMessage.cpp index 9750c04..2c8228e 100755 --- a/framework/storage-handler/MsgStorageMessage.cpp +++ b/framework/storage-handler/MsgStorageMessage.cpp @@ -922,7 +922,9 @@ msg_error_t MsgStoDeleteMessage(msg_message_id_t msgId, bool bCheckIndication) if (dbHandle->stepQuery() == MSG_ERR_DB_ROW) { strncpy(filePath, (char *)dbHandle->columnText(0), MSG_FILEPATH_LEN_MAX); - snprintf(dirPath, MSG_FILEPATH_LEN_MAX, "%s.dir", filePath); + int wrn = snprintf(dirPath, MSG_FILEPATH_LEN_MAX, "%s.dir", filePath); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); if (remove(filePath) == -1) MSG_SEC_DEBUG("Fail to delete file [%s]", filePath); @@ -1270,7 +1272,9 @@ msg_error_t MsgStoDeleteAllMessageInFolder(msg_folder_id_t folderId, bool bOnlyD MSG_SEC_DEBUG("filePath [%s]", filePath); /*delete raw file */ - snprintf(dirPath, sizeof(dirPath), "%s.dir", filePath); + int wrn = snprintf(dirPath, sizeof(dirPath), "%s.dir", filePath); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); if (remove(filePath) == -1) MSG_SEC_DEBUG("Fail to delete file [%s]", filePath); @@ -1595,7 +1599,9 @@ msg_error_t MsgStoDeleteMessageByList(msg_id_list_s *pMsgIdList) MSG_SEC_DEBUG("filePath [%s]", filePath); /* Delete raw file. */ - snprintf(dirPath, sizeof(dirPath), "%s.dir", filePath); + int wrn = snprintf(dirPath, sizeof(dirPath), "%s.dir", filePath); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); if (remove(filePath) == -1) MSG_SEC_DEBUG("Fail to delete file [%s]", filePath); @@ -2521,7 +2527,9 @@ msg_error_t MsgStoSetTempAddressTable(MSG_ADDRESS_INFO_S *pAddrInfo, int addr_cn memset(newPhoneNum, 0x00, sizeof(newPhoneNum)); memset(tmpNum, 0x00, sizeof(tmpNum)); MsgConvertNumber(pAddrInfo[i].addressVal, tmpNum, sizeof(tmpNum)); - snprintf(newPhoneNum, sizeof(newPhoneNum), "%%%%%s", tmpNum); + int wrn = snprintf(newPhoneNum, sizeof(newPhoneNum), "%%%%%s", tmpNum); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); dbHandle->resetQuery(); dbHandle->bindText(newPhoneNum, 1); if (dbHandle->stepQuery() != MSG_ERR_DB_DONE) { diff --git a/framework/submit-handler/MsgSubmitHandler.cpp b/framework/submit-handler/MsgSubmitHandler.cpp index a4e2c44..14ac522 100755 --- a/framework/submit-handler/MsgSubmitHandler.cpp +++ b/framework/submit-handler/MsgSubmitHandler.cpp @@ -163,7 +163,9 @@ msg_error_t MsgSubmitReqMMS(MSG_REQUEST_INFO_S *pReqInfo) /* copy whole of MMS PDU filepath to msgData */ strncpy(fileName, pReqInfo->msgInfo.msgData, MSG_FILENAME_LEN_MAX); memset(pReqInfo->msgInfo.msgData, 0x00, sizeof(pReqInfo->msgInfo.msgData)); - snprintf(pReqInfo->msgInfo.msgData, sizeof(pReqInfo->msgInfo.msgData), "%s%s", MSG_IPC_DATA_PATH, fileName); + int wrn = snprintf(pReqInfo->msgInfo.msgData, sizeof(pReqInfo->msgInfo.msgData), "%s%s", MSG_IPC_DATA_PATH, fileName); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); MSG_SEC_DEBUG("JAVA MMS PDU filepath:%s", pReqInfo->msgInfo.msgData); diff --git a/manager/src/msg-manager-notification.cpp b/manager/src/msg-manager-notification.cpp index 78dc161..4b00f08 100644 --- a/manager/src/msg-manager-notification.cpp +++ b/manager/src/msg-manager-notification.cpp @@ -870,6 +870,7 @@ void setTextDomain(notification_h noti_h) void setText(notification_h noti_h, MSG_MGR_NOTI_INFO_S *noti_info) { MSG_MGR_BEGIN(); + int wrn = 0; char unreadMsgCntStr[10] = {0}; int bPreview = 1; @@ -975,7 +976,9 @@ void setText(notification_h noti_h, MSG_MGR_NOTI_INFO_S *noti_info) setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "Message", MSG_MESSAGE); setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, "Failed to send message.", FAILED_TO_SEND_MESSAGE); if (noti_info->count > 1) { - snprintf(unreadMsgCntStr, sizeof(unreadMsgCntStr), "%d", noti_info->count); + wrn = snprintf(unreadMsgCntStr, sizeof(unreadMsgCntStr), "%d", noti_info->count); + if(wrn<0) + MSG_MGR_INFO("snprintf was failed"); setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, unreadMsgCntStr, NULL); } setNotiTime(noti_h, noti_info->time); @@ -990,7 +993,9 @@ void setText(notification_h noti_h, MSG_MGR_NOTI_INFO_S *noti_info) if (noti_info->count == 1) { setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, "1", NULL); } else if (noti_info->count > 1) { - snprintf(unreadMsgCntStr, sizeof(unreadMsgCntStr), "%d", noti_info->count); + wrn = snprintf(unreadMsgCntStr, sizeof(unreadMsgCntStr), "%d", noti_info->count); + if(wrn<0) + MSG_MGR_INFO("snprintf was failed"); setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, unreadMsgCntStr, NULL); } else { MSG_MGR_DEBUG("Invalid notification count, [cnt = %d]", noti_info->count); @@ -1029,11 +1034,15 @@ void setText(notification_h noti_h, MSG_MGR_NOTI_INFO_S *noti_info) char readStatusString[50] = {0, }; if (noti_info->extra_data == MSG_READ_REPORT_IS_DELETED) { - snprintf(readStatusString, sizeof(readStatusString), "Message deleted by %s", noti_info->sender); + wrn = snprintf(readStatusString, sizeof(readStatusString), "Message deleted by %s", noti_info->sender); + if(wrn<0) + MSG_MGR_INFO("snprintf was failed"); notification_set_text(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, readStatusString, MESSAGE_DELETED_BY_PS, NOTIFICATION_VARIABLE_TYPE_STRING, noti_info->sender, NOTIFICATION_VARIABLE_TYPE_NONE); } else { char readStatusString[50] = {0, }; - snprintf(readStatusString, sizeof(readStatusString), "Message read by %s", noti_info->sender); + wrn = snprintf(readStatusString, sizeof(readStatusString), "Message read by %s", noti_info->sender); + if(wrn<0) + MSG_MGR_INFO("snprintf was failed"); notification_set_text(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, readStatusString, MESSAGE_READ_BY_PS, NOTIFICATION_VARIABLE_TYPE_STRING, noti_info->sender, NOTIFICATION_VARIABLE_TYPE_NONE); } @@ -1267,6 +1276,7 @@ void setActiveText(notification_h noti_h, MSG_MGR_NOTI_INFO_S *noti_info) { MSG_MGR_BEGIN(); + int wrn=0; switch (noti_info->type) { case MSG_MGR_NOTI_TYPE_NORMAL: case MSG_MGR_NOTI_TYPE_SIM: @@ -1278,7 +1288,9 @@ void setActiveText(notification_h noti_h, MSG_MGR_NOTI_INFO_S *noti_info) } else { if (noti_info->active_media_cnt > 1) { char attach_string[20] = {0, }; - snprintf(attach_string, sizeof(attach_string), "%d attachments", noti_info->active_media_cnt); + wrn = snprintf(attach_string, sizeof(attach_string), "%d attachments", noti_info->active_media_cnt); + if(wrn<0) + MSG_MGR_INFO("snprintf was failed"); notification_set_text(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, attach_string, MSG_PD_ATTACHMENTS, NOTIFICATION_VARIABLE_TYPE_INT, noti_info->active_media_cnt, NOTIFICATION_VARIABLE_TYPE_NONE); } else if (noti_info->active_media_cnt == 1) { setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, "1 attachment", MSG_SINGLE_ATTACHMENT); @@ -1292,7 +1304,9 @@ void setActiveText(notification_h noti_h, MSG_MGR_NOTI_INFO_S *noti_info) } else { if (noti_info->active_media_cnt > 1) { char attach_string[20] = {0, }; - snprintf(attach_string, sizeof(attach_string), "%d attachments", noti_info->active_media_cnt); + wrn = snprintf(attach_string, sizeof(attach_string), "%d attachments", noti_info->active_media_cnt); + if(wrn<0) + MSG_MGR_INFO("snprintf was failed"); setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, attach_string, NULL); } else if (noti_info->active_media_cnt == 1) { setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, "1 attachment", NULL); @@ -1498,6 +1512,7 @@ void setSoundAndVibration(notification_h noti_h, char *addressVal, bool bVoiceMa void setActiveNotification(notification_h noti_h, MSG_MGR_NOTI_INFO_S *noti_info) { MSG_MGR_BEGIN(); + int wrn = 0; int noti_err = NOTIFICATION_ERROR_NONE; @@ -1510,7 +1525,9 @@ void setActiveNotification(notification_h noti_h, MSG_MGR_NOTI_INFO_S *noti_info MSG_MGR_DEBUG("Active Notification button 1 - Msg Id = [%d]", noti_info->msg_id); char tel_num[MSG_NOTI_TEXT_LEN_S] = {0, }; - snprintf(tel_num, sizeof(tel_num), "tel:%s", noti_info->number); + wrn = snprintf(tel_num, sizeof(tel_num), "tel:%s", noti_info->number); + if(wrn<0) + MSG_MGR_DEBUG("snprintf was failed"); MSG_MGR_SEC_DEBUG("Active sender number [%s]", noti_info->number); setServiceUri(noti_info->active_noti_svc_h[0], tel_num); } @@ -1525,7 +1542,9 @@ void setActiveNotification(notification_h noti_h, MSG_MGR_NOTI_INFO_S *noti_info addServiceExtraData(noti_info->active_noti_svc_h[1], "addr", noti_info->number); char slot_id[5] = {0, }; - snprintf(slot_id, sizeof(slot_id), "%d", noti_info->sim_idx); + wrn = snprintf(slot_id, sizeof(slot_id), "%d", noti_info->sim_idx); + if(wrn<0) + MSG_MGR_DEBUG("snprintf was failed"); addServiceExtraData(noti_info->active_noti_svc_h[1], "slot_id", slot_id); } } @@ -1540,7 +1559,9 @@ void setActiveNotification(notification_h noti_h, MSG_MGR_NOTI_INFO_S *noti_info addServiceExtraData(noti_info->active_noti_svc_h[2], "CALLER", "active_noti"); char slot_id[5] = {0, }; - snprintf(slot_id, sizeof(slot_id), "%d", noti_info->sim_idx - 1); + wrn = snprintf(slot_id, sizeof(slot_id), "%d", noti_info->sim_idx - 1); + if(wrn<0) + MSG_MGR_DEBUG("snprintf was failed"); addServiceExtraData(noti_info->active_noti_svc_h[2], "slot_id", slot_id); } @@ -1644,6 +1665,7 @@ void createActiveInfoData(MSG_MGR_NOTI_INFO_S *noti_info, MSG_MGR_MESSAGE_INFO_S { MSG_MGR_BEGIN(); + int wrn = 0; if (!msg_info) { MSG_MGR_DEBUG("msg_info is NULL"); return; @@ -1655,7 +1677,9 @@ void createActiveInfoData(MSG_MGR_NOTI_INFO_S *noti_info, MSG_MGR_MESSAGE_INFO_S switch (noti_info->type) { case MSG_MGR_NOTI_TYPE_NORMAL: { char *senderStr = get_translate_text(MSG_MGR_PACKAGE_NAME, MSG_MGR_LOCALEDIR, PUSH_MESSAGE); - snprintf(noti_info->active_sender, MSG_NOTI_TEXT_LEN_S, "%s", senderStr); + wrn = snprintf(noti_info->active_sender, MSG_NOTI_TEXT_LEN_S, "%s", senderStr); + if(wrn<0) + MSG_MGR_DEBUG("snprintf was failed"); if (senderStr) { free(senderStr); senderStr = NULL; @@ -1664,11 +1688,21 @@ void createActiveInfoData(MSG_MGR_NOTI_INFO_S *noti_info, MSG_MGR_MESSAGE_INFO_S } case MSG_MGR_NOTI_TYPE_CLASS0: { if (msg_info->displayName[0] == '\0') - snprintf(noti_info->active_sender, MSG_NOTI_TEXT_LEN_S, "%s", msg_info->addressVal); + { + wrn = snprintf(noti_info->active_sender, MSG_NOTI_TEXT_LEN_S, "%s", msg_info->addressVal); + if(wrn<0) + MSG_MGR_DEBUG("snprintf was failed"); + } else - snprintf(noti_info->active_sender, MSG_NOTI_TEXT_LEN_S, "%s", msg_info->displayName); + { + wrn = snprintf(noti_info->active_sender, MSG_NOTI_TEXT_LEN_S, "%s", msg_info->displayName); + if(wrn<0) + MSG_MGR_DEBUG("snprintf was failed"); + } - snprintf(noti_info->active_text, MSG_NOTI_TEXT_LEN, "%s", msg_info->msgText); + wrn = snprintf(noti_info->active_text, MSG_NOTI_TEXT_LEN, "%s", msg_info->msgText); + if(wrn<0) + MSG_MGR_DEBUG("snprintf was failed"); break; } default: @@ -1757,6 +1791,7 @@ int getLatestMsgInfo(MSG_MGR_NOTI_INFO_S *noti_info, bool isForInstantMessage) { MSG_MGR_BEGIN(); + int wrn = 0; int noti_err = 0; msg_error_t msg_err = MSG_SUCCESS; char **db_res = NULL; @@ -1839,7 +1874,9 @@ int getLatestMsgInfo(MSG_MGR_NOTI_INFO_S *noti_info, bool isForInstantMessage) MsgMgrGetContactInfo(&tmpAddressInfo, &tmpContact); if (row_cnt == 1) { - snprintf(noti_info->imagePath, sizeof(noti_info->imagePath), "%s", tmpContact.imagePath); + wrn = snprintf(noti_info->imagePath, sizeof(noti_info->imagePath), "%s", tmpContact.imagePath); + if(wrn<0) + MSG_MGR_DEBUG("snprintf was failed"); } if (normalAddCnt > 1) { @@ -1888,8 +1925,12 @@ int getLatestMsgInfo(MSG_MGR_NOTI_INFO_S *noti_info, bool isForInstantMessage) if (i == 1) { noti_info->active_subtype = subType; - snprintf(noti_info->active_sender, MSG_NOTI_TEXT_LEN_S, "%s", noti_info->sender); - snprintf(noti_info->imagePath, sizeof(noti_info->imagePath), "%s", tmpContact.imagePath); + wrn = snprintf(noti_info->active_sender, MSG_NOTI_TEXT_LEN_S, "%s", noti_info->sender); + if(wrn<0) + MSG_MGR_DEBUG("snprintf was failed"); + wrn = snprintf(noti_info->imagePath, sizeof(noti_info->imagePath), "%s", tmpContact.imagePath); + if(wrn<0) + MSG_MGR_DEBUG("snprintf was failed"); } } @@ -2028,10 +2069,14 @@ int getLatestMsgInfo(MSG_MGR_NOTI_INFO_S *noti_info, bool isForInstantMessage) char *prefix_subject = get_translate_text(MSG_MGR_PACKAGE_NAME, MSG_MGR_LOCALEDIR, MSG_SUBJECT_COLON); if (prefix_subject) { - snprintf(noti_info->active_subject, MSG_NOTI_TEXT_LEN_S, "%s%s", prefix_subject, noti_info->text); + wrn = snprintf(noti_info->active_subject, MSG_NOTI_TEXT_LEN_S, "%s%s", prefix_subject, noti_info->text); + if(wrn<0) + MSG_MGR_DEBUG("snprintf was failed"); g_free(prefix_subject); } else { - snprintf(noti_info->active_subject, MSG_NOTI_TEXT_LEN_S, "%s", noti_info->text); + wrn = snprintf(noti_info->active_subject, MSG_NOTI_TEXT_LEN_S, "%s", noti_info->text); + if(wrn<0) + MSG_MGR_DEBUG("snprintf was failed"); } if (msgSize > -1) { @@ -2569,6 +2614,7 @@ void createInfoData(MSG_MGR_NOTI_INFO_S *noti_info, MSG_MGR_MESSAGE_INFO_S *msg_ MSG_MGR_DEBUG("msg_info is NULL"); return; } + int wrn = 0; noti_info->sim_idx = msg_info->sim_idx; @@ -2611,7 +2657,9 @@ void createInfoData(MSG_MGR_NOTI_INFO_S *noti_info, MSG_MGR_MESSAGE_INFO_S *msg_ setServiceUri(noti_info->svc_h, MSG_TEL_URI_VOICEMAIL); char slot_id[5] = {0, }; - snprintf(slot_id, sizeof(slot_id), "%d", msg_info->sim_idx - 1); + wrn = snprintf(slot_id, sizeof(slot_id), "%d", msg_info->sim_idx - 1); + if(wrn<0) + MSG_MGR_INFO("snprintf was failed"); addServiceExtraData(noti_info->svc_h, "slot_id", slot_id); } @@ -2632,7 +2680,9 @@ void createInfoData(MSG_MGR_NOTI_INFO_S *noti_info, MSG_MGR_MESSAGE_INFO_S *msg_ snprintf(noti_info->number, sizeof(noti_info->number), "%s", msg_info->addressVal); - snprintf(noti_info->text, sizeof(noti_info->text), "%s", msg_info->msgText); + wrn = snprintf(noti_info->text, sizeof(noti_info->text), "%s", msg_info->msgText); + if(wrn<0) + MSG_MGR_INFO("snprintf was failed"); if (noti_info->type == MSG_MGR_NOTI_TYPE_MWI) { if (noti_info->svc_h) { @@ -2640,7 +2690,9 @@ void createInfoData(MSG_MGR_NOTI_INFO_S *noti_info, MSG_MGR_MESSAGE_INFO_S *msg_ setServiceUri(noti_info->svc_h, MSG_TEL_URI_VOICEMAIL); char slot_id[5] = {0, }; - snprintf(slot_id, sizeof(slot_id), "%d", msg_info->sim_idx - 1); + wrn = snprintf(slot_id, sizeof(slot_id), "%d", msg_info->sim_idx - 1); + if(wrn<0) + MSG_MGR_INFO("snprintf was failed"); addServiceExtraData(noti_info->svc_h, "slot_id", slot_id); } @@ -2660,7 +2712,9 @@ void createInfoData(MSG_MGR_NOTI_INFO_S *noti_info, MSG_MGR_MESSAGE_INFO_S *msg_ MSG_MGR_CONTACT_INFO_S contactInfo = {0, }; MSG_MGR_ADDRESS_INFO_S tmpAddressInfo = {0, }; if (msg_info->addressVal[0] != '\0') { - snprintf(tmpAddressInfo.addressVal, MAX_ADDRESS_VAL_LEN, "%s", msg_info->addressVal); + wrn = snprintf(tmpAddressInfo.addressVal, MAX_ADDRESS_VAL_LEN, "%s", msg_info->addressVal); + if(wrn<0) + MSG_MGR_INFO("snprintf was failed"); if (_is_valid_email(msg_info->addressVal)) { tmpAddressInfo.addressType = MSG_ADDRESS_TYPE_EMAIL; } else { @@ -2677,7 +2731,9 @@ void createInfoData(MSG_MGR_NOTI_INFO_S *noti_info, MSG_MGR_MESSAGE_INFO_S *msg_ else snprintf(noti_info->sender, sizeof(noti_info->sender), "%s", contactInfo.firstName); - snprintf(noti_info->number, sizeof(noti_info->number), "%s", msg_info->addressVal); + wrn = snprintf(noti_info->number, sizeof(noti_info->number), "%s", msg_info->addressVal); + if(wrn<0) + MSG_MGR_INFO("snprintf was failed"); if (noti_info->msg_id > 0) { setServiceAppId(noti_info->svc_h, _get_app_id()); @@ -2696,7 +2752,9 @@ void createInfoData(MSG_MGR_NOTI_INFO_S *noti_info, MSG_MGR_MESSAGE_INFO_S *msg_ MSG_MGR_CONTACT_INFO_S contactInfo = {0, }; MSG_MGR_ADDRESS_INFO_S tmpAddressInfo = {0, }; if (msg_info->addressVal[0] != '\0') { - snprintf(tmpAddressInfo.addressVal, MAX_ADDRESS_VAL_LEN, "%s", msg_info->addressVal); + wrn = snprintf(tmpAddressInfo.addressVal, MAX_ADDRESS_VAL_LEN, "%s", msg_info->addressVal); + if(wrn<0) + MSG_MGR_INFO("snprintf was failed"); if (_is_valid_email(msg_info->addressVal)) { tmpAddressInfo.addressType = MSG_ADDRESS_TYPE_EMAIL; } else { diff --git a/mapi/msg_mms.cpp b/mapi/msg_mms.cpp index 61a40f0..ca02aa4 100755 --- a/mapi/msg_mms.cpp +++ b/mapi/msg_mms.cpp @@ -92,7 +92,9 @@ static void __removeLessGreaterMark(const char *szSrcID, char *szDest, int destS szBuf[cLen] = '\0'; } - snprintf(szDest, destSize, "%s", szBuf); + int wrn = snprintf(szDest, destSize, "%s", szBuf); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); } static inline void *get_msg_struct_data(msg_struct_s *msg_struct) diff --git a/plugin/mms_plugin/MmsPluginAppBase.cpp b/plugin/mms_plugin/MmsPluginAppBase.cpp index fa88de6..4c703a4 100755 --- a/plugin/mms_plugin/MmsPluginAppBase.cpp +++ b/plugin/mms_plugin/MmsPluginAppBase.cpp @@ -200,11 +200,16 @@ msg_error_t MmsMakePreviewInfo(int msgId, MMS_MESSAGE_DATA_S *pMmsMsg, bool allo if (pMedia->drmType == MSG_DRM_TYPE_NONE) { snprintf(szFileName, MSG_FILENAME_LEN_MAX+1, "%d.mms", msgId); + int wrn =0; if ((pszExt = strrchr(pMedia->szFilePath, '.')) != NULL && !strcasecmp(pszExt, ".png")) { - snprintf(thumbPath, MSG_FILEPATH_LEN_MAX, "%s%s.png", MSG_THUMBNAIL_PATH, szFileName); + wrn = snprintf(thumbPath, MSG_FILEPATH_LEN_MAX, "%s%s.png", MSG_THUMBNAIL_PATH, szFileName); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); } else { - snprintf(thumbPath, MSG_FILEPATH_LEN_MAX, "%s%s.jpg", MSG_THUMBNAIL_PATH, szFileName); + wrn = snprintf(thumbPath, MSG_FILEPATH_LEN_MAX, "%s%s.jpg", MSG_THUMBNAIL_PATH, szFileName); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); } if (MakeThumbnail(pMedia->szFilePath, thumbPath) == true) { diff --git a/plugin/mms_plugin/MmsPluginDecode.cpp b/plugin/mms_plugin/MmsPluginDecode.cpp index a55740c..2f0621d 100755 --- a/plugin/mms_plugin/MmsPluginDecode.cpp +++ b/plugin/mms_plugin/MmsPluginDecode.cpp @@ -1474,7 +1474,7 @@ static int __MmsBinaryDecodeContentType(FILE *pFile, MsgType *pMsgType, int tota pMsgType->type = MimeGetMimeIntFromMimeString(szTypeString); - MSG_SEC_DEBUG("Constrained-media : Extension-Media : Content Type = [%s], MimeType = [0x%04x]", szTypeString, pMsgType->type); + //MSG_SEC_DEBUG("Constrained-media : Extension-Media : Content Type = [%s], MimeType = [0x%04x]", szTypeString, pMsgType->type); length = textLength; @@ -2251,6 +2251,7 @@ static bool __MmsBinaryDecodeEachPart(FILE *pFile, char *szFilePath, MsgType *pM UINT32 headerLength = 0; UINT32 bodyLength = 0; int offset = 0; + int wrn =0; MSG_DEBUG("pdu length = [%d]", totalLength); @@ -2276,7 +2277,12 @@ static bool __MmsBinaryDecodeEachPart(FILE *pFile, char *szFilePath, MsgType *pM /* Content Type */ if (szFilePath != NULL) - snprintf(pMsgType->szOrgFilePath, sizeof(pMsgType->szOrgFilePath), "%s", szFilePath); + { + wrn = snprintf(pMsgType->szOrgFilePath, sizeof(pMsgType->szOrgFilePath), "%s", szFilePath); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); + } + pMsgType->offset = __MmsGetDecodeOffset(); pMsgType->size = headerLength; @@ -2310,7 +2316,11 @@ static bool __MmsBinaryDecodeEachPart(FILE *pFile, char *szFilePath, MsgType *pM /* Part Body */ if (szFilePath != NULL) - snprintf(pMsgBody->szOrgFilePath, sizeof(pMsgBody->szOrgFilePath), "%s", szFilePath); + { + wrn = snprintf(pMsgBody->szOrgFilePath, sizeof(pMsgBody->szOrgFilePath), "%s", szFilePath); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); + } pMsgBody->offset = __MmsGetDecodeOffset(); pMsgBody->size = bodyLength; @@ -2346,12 +2356,21 @@ static bool __MmsBinaryDecodeEachPart(FILE *pFile, char *szFilePath, MsgType *pM char szFileName[MSG_FILENAME_LEN_MAX+1] = {0}; MimeType mimeType = MIME_UNKNOWN; - if (pMsgType->param.szName[0] != '\0') - snprintf(szFileName, MSG_FILENAME_LEN_MAX, "%s", pMsgType->param.szName); - else if (pMsgType->param.szFileName[0] != '\0') - snprintf(szFileName, MSG_FILENAME_LEN_MAX, "%s", pMsgType->param.szFileName); - else if (pMsgType->szContentLocation[0] != '\0') - snprintf(szFileName, MSG_FILENAME_LEN_MAX, "%s", pMsgType->szContentLocation); + if (pMsgType->param.szName[0] != '\0') { + wrn = snprintf(szFileName, MSG_FILENAME_LEN_MAX, "%s", pMsgType->param.szName); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); + } + else if (pMsgType->param.szFileName[0] != '\0'){ + wrn = snprintf(szFileName, MSG_FILENAME_LEN_MAX, "%s", pMsgType->param.szFileName); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); + } + else if (pMsgType->szContentLocation[0] != '\0'){ + wrn = snprintf(szFileName, MSG_FILENAME_LEN_MAX, "%s", pMsgType->szContentLocation); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); + } MsgGetMimeTypeFromFileName(MIME_MAINTYPE_UNKNOWN, szFileName, &mimeType, NULL); pMsgType->type = mimeType; @@ -3715,6 +3734,7 @@ bool MmsReadMsgBody(msg_message_id_t msgID, bool bSavePartsAsTempFiles, bool bRe int nSize = 0; char szFullPath[MSG_FILEPATH_LEN_MAX] = {0, }; char szTempMediaDir[MSG_FILEPATH_LEN_MAX] = {0, }; + int wrn =0; MSG_BEGIN(); @@ -3836,7 +3856,9 @@ bool MmsReadMsgBody(msg_message_id_t msgID, bool bSavePartsAsTempFiles, bool bRe } /* make temporary */ - snprintf(szTempMediaDir, MSG_FILEPATH_LEN_MAX, "%s%s.dir", MSG_DATA_PATH, pMsg->szFileName); + wrn = snprintf(szTempMediaDir, MSG_FILEPATH_LEN_MAX, "%s%s.dir", MSG_DATA_PATH, pMsg->szFileName); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); if (MsgIsMultipart(pMsg->msgType.type) == true) { int partIndex = 0; @@ -5519,6 +5541,7 @@ static bool __MmsMultipartSaveAsTempFile(MsgType *pPartType, MsgBody *pPartBody, char szFullPath[MSG_FILEPATH_LEN_MAX] = {0, }; /* full absolute path of temp file. */ bool bFileExist = false; MSG_BEGIN(); + int wrn =0; if (!pPartType) { MSG_DEBUG("pPartType is NULL"); @@ -5526,23 +5549,36 @@ static bool __MmsMultipartSaveAsTempFile(MsgType *pPartType, MsgBody *pPartBody, } if (pPartType->type == MIME_APPLICATION_SMIL) { - snprintf(szFileName, MSG_FILENAME_LEN_MAX+1, "%s", "smil.txt"); + wrn = snprintf(szFileName, MSG_FILENAME_LEN_MAX+1, "%s", "smil.txt"); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); } else { if (pPartType->param.szName[0] != '\0') { - snprintf(szFileName, MSG_FILENAME_LEN_MAX+1, "%s", pPartType->param.szName); + wrn = snprintf(szFileName, MSG_FILENAME_LEN_MAX+1, "%s", pPartType->param.szName); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); } else if (pPartType->param.szFileName[0] != '\0') { - snprintf(szFileName, MSG_FILENAME_LEN_MAX+1, "%s", pPartType->param.szFileName); + wrn = snprintf(szFileName, MSG_FILENAME_LEN_MAX+1, "%s", pPartType->param.szFileName); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); } else if (pPartType->szContentLocation[0] != '\0') { - snprintf(szFileName, MSG_FILENAME_LEN_MAX+1, "%s", pPartType->szContentLocation); + wrn = snprintf(szFileName, MSG_FILENAME_LEN_MAX+1, "%s", pPartType->szContentLocation); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); } else { - snprintf(szFileName, MSG_FILENAME_LEN_MAX+1, "%lu", (unsigned long)index); + wrn = snprintf(szFileName, MSG_FILENAME_LEN_MAX+1, "%lu", (unsigned long)index); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); } } /* make full path for save */ __MsgMakeFileName(pPartType->type, szFileName, pPartType->drmInfo.drmType, 0, szFileName, sizeof(szFileName)); /* FL & CD -> extension(.dm) SD -> extension(.dcf) */ - snprintf(szFullPath, MSG_FILEPATH_LEN_MAX, "%s%s.dir/%s", pszMailboxPath, pszMsgFilename, szFileName); /* get absolute path of each temp file of each part */ + wrn = snprintf(szFullPath, MSG_FILEPATH_LEN_MAX, "%s%s.dir/%s", pszMailboxPath, pszMsgFilename, szFileName); /* get absolute path of each temp file of each part */ + if(wrn<0) + MSG_DEBUG("snprintf was failed"); + if (pPartType->type == MIME_APPLICATION_OCTET_STREAM) MsgGetMimeTypeFromFileName(MIME_MAINTYPE_UNKNOWN, szFullPath, (MimeType *)&pPartType->type, NULL); @@ -5638,8 +5674,12 @@ static bool __MmsMultipartSaveAsTempFile(MsgType *pPartType, MsgBody *pPartBody, /* file name fix */ if (szFileName[0] != '\0') { - snprintf(pPartType->param.szFileName, MSG_FILENAME_LEN_MAX+1, "%s.dir/%s", pszMsgFilename, szFileName); /* store relative path of each temp file of each part including sub folder. */ - snprintf(pPartType->param.szName, MSG_LOCALE_FILENAME_LEN_MAX+1, "%s", szFileName); + int wrn = snprintf(pPartType->param.szFileName, MSG_FILENAME_LEN_MAX+1, "%s.dir/%s", pszMsgFilename, szFileName); /* store relative path of each temp file of each part including sub folder. */ + if(wrn<0) + MSG_DEBUG("snprintf was failed"); + wrn = snprintf(pPartType->param.szName, MSG_LOCALE_FILENAME_LEN_MAX+1, "%s", szFileName); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); MSG_SEC_DEBUG("Set Name : %s", pPartType->param.szName); } @@ -5877,6 +5917,7 @@ static bool __MsgMakeFileName(int iMsgType, char *szFileName, MsgDrmType drmType char szTemp[MSG_FILENAME_LEN_MAX+1] = {0, }; char szTempFileName[MSG_FILENAME_LEN_MAX+1] = {0, }; const char *pExt = NULL; + int wrn =0; MSG_SEC_DEBUG("Input : type [0x%x], drmType [%d], filename [%s]", iMsgType, drmType, szFileName); @@ -5920,13 +5961,17 @@ static bool __MsgMakeFileName(int iMsgType, char *szFileName, MsgDrmType drmType /* Filename + extension */ if (pExt) { - snprintf(szTemp, sizeof(szTemp), "%s.%s", szTempFileName, pExt); + wrn = snprintf(szTemp, sizeof(szTemp), "%s.%s", szTempFileName, pExt); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); } else { MSG_DEBUG("Failed to get extension of that mime data file."); goto __CATCH; } - snprintf(outBuf, outBufLen, "%s", szTemp); + wrn = snprintf(outBuf, outBufLen, "%s", szTemp); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); MSG_SEC_DEBUG("Result : filename [%s]", outBuf); return true; @@ -6028,6 +6073,7 @@ void MmsPluginDecoder::decodeMmsPdu(MmsMsg *pMsg, msg_message_id_t msgID, const MSG_BEGIN(); FILE *pFile = NULL; + int wrn = 0; MsgMultipart *pMultipart = NULL; int nSize = 0; char szFullPath[MSG_FILEPATH_LEN_MAX] = {0, }; @@ -6144,7 +6190,9 @@ void MmsPluginDecoder::decodeMmsPdu(MmsMsg *pMsg, msg_message_id_t msgID, const } /* make temporary */ - snprintf(szTempMediaDir, MSG_FILEPATH_LEN_MAX, "%s%s.dir", MSG_DATA_PATH, pMsg->szFileName); + wrn = snprintf(szTempMediaDir, MSG_FILEPATH_LEN_MAX, "%s%s.dir", MSG_DATA_PATH, pMsg->szFileName); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); if (MsgIsMultipart(pMsg->msgType.type) == true) { int partIndex = 0; diff --git a/plugin/mms_plugin/MmsPluginEncode.cpp b/plugin/mms_plugin/MmsPluginEncode.cpp index 7444cb8..0ee9b09 100755 --- a/plugin/mms_plugin/MmsPluginEncode.cpp +++ b/plugin/mms_plugin/MmsPluginEncode.cpp @@ -957,6 +957,7 @@ static bool __MmsBinaryEncodeReadReport10Hdr(FILE *pFile, MmsMsg *pMsg, msg_read UINT8 fieldCode = 0xff; UINT8 fieldValue = 0xff; char szSubject[MSG_LOCALE_SUBJ_LEN + 8] = {0, }; + int wrn =0; if (pMsg == NULL) { MSG_DEBUG("pMsg is NULL"); @@ -1031,16 +1032,24 @@ static bool __MmsBinaryEncodeReadReport10Hdr(FILE *pFile, MmsMsg *pMsg, msg_read /* Subject = Encoded-string-value */ if (pMsg && pMsg->mmsAttrib.szSubject[0]) { if (mmsReadStatus == MSG_READ_REPORT_IS_READ) { - snprintf(szSubject, MSG_LOCALE_SUBJ_LEN + 8, "%s%s", MMS_READ_REPORT_STRING_READ, pMsg->mmsAttrib.szSubject); + wrn = snprintf(szSubject, MSG_LOCALE_SUBJ_LEN + 8, "%s%s", MMS_READ_REPORT_STRING_READ, pMsg->mmsAttrib.szSubject); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); } else { - snprintf(szSubject, MSG_LOCALE_SUBJ_LEN + 8, "%s%s", MMS_READ_REPORT_STRING_DELETED, pMsg->mmsAttrib.szSubject); + wrn = snprintf(szSubject, MSG_LOCALE_SUBJ_LEN + 8, "%s%s", MMS_READ_REPORT_STRING_DELETED, pMsg->mmsAttrib.szSubject); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); } } else { if (mmsReadStatus == MSG_READ_REPORT_IS_READ) { - snprintf(szSubject, MSG_LOCALE_SUBJ_LEN + 8, "%s", MMS_READ_REPORT_STRING_READ); + wrn = snprintf(szSubject, MSG_LOCALE_SUBJ_LEN + 8, "%s", MMS_READ_REPORT_STRING_READ); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); } else { - snprintf(szSubject, MSG_LOCALE_SUBJ_LEN + 8, "%s", MMS_READ_REPORT_STRING_DELETED); + wrn = snprintf(szSubject, MSG_LOCALE_SUBJ_LEN + 8, "%s", MMS_READ_REPORT_STRING_DELETED); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); } } diff --git a/plugin/mms_plugin/MmsPluginHttp.cpp b/plugin/mms_plugin/MmsPluginHttp.cpp index 4036817..edc5572 100755 --- a/plugin/mms_plugin/MmsPluginHttp.cpp +++ b/plugin/mms_plugin/MmsPluginHttp.cpp @@ -123,10 +123,13 @@ static void __httpAllocHeaderInfo(curl_slist **responseHeaders, char *szUrl, int { char szBuffer[1025] = {0, }; char pcheader[HTTP_REQUEST_LEN] = {0, }; + int wrn =0; bool nResult = __httpGetHeaderField(MMS_HH_CONTENT_TYPE, szBuffer); if (nResult) { - snprintf(pcheader, HTTP_REQUEST_LEN, "Content-Type: %s", szBuffer); + wrn = snprintf(pcheader, HTTP_REQUEST_LEN, "Content-Type: %s", szBuffer); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); MSG_INFO("%s", pcheader); *responseHeaders = curl_slist_append(*responseHeaders, pcheader); } @@ -136,7 +139,9 @@ static void __httpAllocHeaderInfo(curl_slist **responseHeaders, char *szUrl, int memset(pcheader, 0, HTTP_REQUEST_LEN); snprintf(szBuffer, 1024, "%d", ulContentLen); if (nResult) { - snprintf(pcheader, HTTP_REQUEST_LEN, "Content-Length: %s", szBuffer); + wrn = snprintf(pcheader, HTTP_REQUEST_LEN, "Content-Length: %s", szBuffer); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); MSG_INFO("%s", pcheader); *responseHeaders = curl_slist_append(*responseHeaders, pcheader); } @@ -147,7 +152,9 @@ static void __httpAllocHeaderInfo(curl_slist **responseHeaders, char *szUrl, int __httpGetHost(szUrl, szBuffer, 1024); if (strlen(szBuffer)) { - snprintf(pcheader, HTTP_REQUEST_LEN, "Host: %s", szBuffer); + wrn = snprintf(pcheader, HTTP_REQUEST_LEN, "Host: %s", szBuffer); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); MSG_INFO("%s", pcheader); *responseHeaders = curl_slist_append(*responseHeaders, pcheader); } @@ -156,7 +163,9 @@ static void __httpAllocHeaderInfo(curl_slist **responseHeaders, char *szUrl, int memset(pcheader, 0, HTTP_REQUEST_LEN); nResult = __httpGetHeaderField(MMS_HH_ACCEPT, szBuffer); if (nResult) { - snprintf(pcheader, HTTP_REQUEST_LEN, "Accept: %s", szBuffer); + wrn = snprintf(pcheader, HTTP_REQUEST_LEN, "Accept: %s", szBuffer); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); MSG_INFO("%s", pcheader); *responseHeaders = curl_slist_append(*responseHeaders, pcheader); } @@ -165,7 +174,9 @@ static void __httpAllocHeaderInfo(curl_slist **responseHeaders, char *szUrl, int memset(pcheader, 0, HTTP_REQUEST_LEN); nResult = __httpGetHeaderField(MMS_HH_ACCEPT_CHARSET, szBuffer); if (nResult) { - snprintf(pcheader, HTTP_REQUEST_LEN, "Accept-Charset: %s", szBuffer); + wrn = snprintf(pcheader, HTTP_REQUEST_LEN, "Accept-Charset: %s", szBuffer); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); MSG_INFO("%s", pcheader); *responseHeaders = curl_slist_append(*responseHeaders, pcheader); } @@ -174,7 +185,9 @@ static void __httpAllocHeaderInfo(curl_slist **responseHeaders, char *szUrl, int memset(pcheader, 0, HTTP_REQUEST_LEN); nResult = __httpGetHeaderField(MMS_HH_ACCEPT_LANGUAGE, szBuffer); if (nResult) { - snprintf(pcheader, HTTP_REQUEST_LEN, "Accept-Language: %s", szBuffer); + wrn = snprintf(pcheader, HTTP_REQUEST_LEN, "Accept-Language: %s", szBuffer); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); MSG_INFO("%s", pcheader); *responseHeaders = curl_slist_append(*responseHeaders, pcheader); } @@ -192,7 +205,9 @@ static void __httpAllocHeaderInfo(curl_slist **responseHeaders, char *szUrl, int memset(pcheader, 0, HTTP_REQUEST_LEN); nResult = __httpGetHeaderField(MMS_HH_USER_AGENT, szBuffer); if (nResult) { - snprintf(pcheader, HTTP_REQUEST_LEN, "User-Agent: %s", szBuffer); + wrn = snprintf(pcheader, HTTP_REQUEST_LEN, "User-Agent: %s", szBuffer); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); MSG_INFO("%s", pcheader); *responseHeaders = curl_slist_append(*responseHeaders, pcheader); } @@ -201,7 +216,9 @@ static void __httpAllocHeaderInfo(curl_slist **responseHeaders, char *szUrl, int memset(pcheader, 0, HTTP_REQUEST_LEN); nResult = __httpGetHeaderField(MMS_HH_UA_PROFILE, szBuffer); if (nResult) { - snprintf(pcheader, HTTP_REQUEST_LEN, "X-wap-profile: %s", szBuffer); + wrn = snprintf(pcheader, HTTP_REQUEST_LEN, "X-wap-profile: %s", szBuffer); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); MSG_SEC_INFO("%s", pcheader); *responseHeaders = curl_slist_append(*responseHeaders, pcheader); } diff --git a/plugin/mms_plugin/MmsPluginInternal.cpp b/plugin/mms_plugin/MmsPluginInternal.cpp index 6b1f5e7..541fe37 100755 --- a/plugin/mms_plugin/MmsPluginInternal.cpp +++ b/plugin/mms_plugin/MmsPluginInternal.cpp @@ -63,6 +63,7 @@ void MmsPluginInternal::processReceivedInd(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_REQ MSG_BEGIN(); FILE *pFile = NULL; + int wrn =0; char fileName[MSG_FILENAME_LEN_MAX] = {0, }; if (pMsgInfo->bTextSms == true) { @@ -76,7 +77,9 @@ void MmsPluginInternal::processReceivedInd(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_REQ if (MsgWriteIpcFile(fileName, pMsgInfo->msgText, pMsgInfo->dataSize) == false) THROW(MsgException::FILE_ERROR, "MsgWriteIpcFile error"); - snprintf(fullPath, MAX_FULL_PATH_SIZE+1, "%s%s", MSG_IPC_DATA_PATH, fileName); + wrn = snprintf(fullPath, MAX_FULL_PATH_SIZE+1, "%s%s", MSG_IPC_DATA_PATH, fileName); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); memset(pMsgInfo->msgData, 0x00, sizeof(pMsgInfo->msgData)); memcpy(pMsgInfo->msgData, fullPath, strlen(fullPath)); @@ -231,12 +234,16 @@ bool MmsPluginInternal::processNotiInd(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_REQUEST if (MsgCreateFileName(pTempFileName) == true) { pMsgInfo->bTextSms = false; - snprintf(pTempFilePath, sizeof(pTempFilePath), "%s%s", MSG_IPC_DATA_PATH, pTempFileName); + int wrn = snprintf(pTempFilePath, sizeof(pTempFilePath), "%s%s", MSG_IPC_DATA_PATH, pTempFileName); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); MsgOpenCreateAndOverwriteFile(pTempFilePath, pSerializedMms, serializeDataSize); /* set file name */ - snprintf(pMsgInfo->msgData, sizeof(pMsgInfo->msgData), "%s", pTempFileName); + wrn = snprintf(pMsgInfo->msgData, sizeof(pMsgInfo->msgData), "%s", pTempFileName); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); } delete [] pSerializedMms; @@ -479,6 +486,7 @@ void MmsPluginInternal::processSendConf(MSG_MESSAGE_INFO_S *pMsgInfo, mmsTranQEn MMS_RECV_DATA_S recvData = {{0}, }; pMsgInfo->msgId = pRequest->msgId; + int wrn =0; /* Set only changed members */ pMsgInfo->msgType.mainType = MSG_MMS_TYPE; @@ -497,7 +505,9 @@ void MmsPluginInternal::processSendConf(MSG_MESSAGE_INFO_S *pMsgInfo, mmsTranQEn char responseText[MMS_LOCALE_RESP_TEXT_LEN]; memset(responseText, 0x00, MMS_LOCALE_RESP_TEXT_LEN); - snprintf(responseText, MMS_LOCALE_RESP_TEXT_LEN, " %s [%d]", mmsHeader.szResponseText, mmsHeader.responseStatus); + wrn = snprintf(responseText, MMS_LOCALE_RESP_TEXT_LEN, " %s [%d]", mmsHeader.szResponseText, mmsHeader.responseStatus); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); memset(pMsgInfo->msgText, 0x00, MAX_MSG_TEXT_LEN + 1); strncpy(pMsgInfo->msgText, responseText, MMS_LOCALE_RESP_TEXT_LEN); @@ -507,7 +517,9 @@ void MmsPluginInternal::processSendConf(MSG_MESSAGE_INFO_S *pMsgInfo, mmsTranQEn char keyName[MAX_VCONFKEY_NAME_LEN]; memset(keyName, 0x00, sizeof(keyName)); - snprintf(keyName, sizeof(keyName), "%s/%d", MSG_SIM_MSISDN, pMsgInfo->sim_idx); + wrn = snprintf(keyName, sizeof(keyName), "%s/%d", MSG_SIM_MSISDN, pMsgInfo->sim_idx); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); char *msisdn = NULL; if (MsgSettingGetString(keyName, &msisdn) != MSG_SUCCESS) { MSG_INFO("MsgSettingGetString() is failed"); @@ -958,11 +970,14 @@ bool MmsPluginInternal::encodeNotifyRespInd(char *szTrID, msg_delivery_report_st FILE *pFile = NULL; char pTempFileName[MSG_FILENAME_LEN_MAX+1] = {0}; char pTempFilePath[MAX_FULL_PATH_SIZE] = {0}; + int wrn = 0; if (MsgCreateFileName(pTempFileName) == false) return false; - snprintf(pTempFilePath, MAX_FULL_PATH_SIZE, "%s%s.noti.ind", MSG_DATA_PATH, pTempFileName); + wrn = snprintf(pTempFilePath, MAX_FULL_PATH_SIZE, "%s%s.noti.ind", MSG_DATA_PATH, pTempFileName); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); pFile = MsgOpenMMSFile(pTempFilePath); @@ -981,7 +996,9 @@ bool MmsPluginInternal::encodeNotifyRespInd(char *szTrID, msg_delivery_report_st if (pSendFilePath) { /* CID 41993: replaced size 'MAX_MSG_DATA_LEN+1' with MAX_FULL_PATH_SIZE */ - snprintf(pSendFilePath, MAX_FULL_PATH_SIZE, "%s.mms", pTempFilePath); + wrn = snprintf(pSendFilePath, MAX_FULL_PATH_SIZE, "%s.mms", pTempFilePath); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); } else { MSG_DEBUG("[ERROR] pSendFilePath is NULL"); return false; @@ -1004,11 +1021,14 @@ bool MmsPluginInternal::encodeAckInd(char *szTrID, bool bReportAllowed, char *pS FILE *pFile = NULL; char pTempFileName[MSG_FILENAME_LEN_MAX+1] = {0}; char pTempFilePath[MAX_FULL_PATH_SIZE] = {0}; + int wrn = 0; if (MsgCreateFileName(pTempFileName) == false) return false; - snprintf(pTempFilePath, MAX_FULL_PATH_SIZE, "%s%s.ack.ind", MSG_DATA_PATH, pTempFileName); + wrn = snprintf(pTempFilePath, MAX_FULL_PATH_SIZE, "%s%s.ack.ind", MSG_DATA_PATH, pTempFileName); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); pFile = MsgOpenMMSFile(pTempFilePath); if (!pFile) { @@ -1025,7 +1045,9 @@ bool MmsPluginInternal::encodeAckInd(char *szTrID, bool bReportAllowed, char *pS MsgCloseFile(pFile); if (pSendFilePath) { - snprintf(pSendFilePath, MAX_MSG_DATA_LEN+1, "%s.mms", pTempFilePath); + wrn = snprintf(pSendFilePath, MAX_MSG_DATA_LEN+1, "%s.mms", pTempFilePath); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); } else { MSG_ERR("pSendFilePath is NULL"); return false; diff --git a/plugin/mms_plugin/MmsPluginMessage.cpp b/plugin/mms_plugin/MmsPluginMessage.cpp index 7743f17..42a3daf 100755 --- a/plugin/mms_plugin/MmsPluginMessage.cpp +++ b/plugin/mms_plugin/MmsPluginMessage.cpp @@ -217,6 +217,7 @@ __CATCH: MsgMultipart *MmsMakeMultipart(MimeType mimeType, char *szTitleName, char *szOrgFilePath, char *szContentID, char *szContentLocation) { MsgMultipart *pMultipart = NULL; + int wrn = 0; if ((pMultipart = MmsAllocMultipart()) == NULL) return NULL; @@ -240,7 +241,9 @@ MsgMultipart *MmsMakeMultipart(MimeType mimeType, char *szTitleName, char *szOrg if (szContentID && szContentID[0]) { memset(pMultipart->type.szContentID, 0, MSG_MSG_ID_LEN + 1); - snprintf(pMultipart->type.szContentID, MSG_MSG_ID_LEN + 1, "<%s>", szContentID); + wrn = snprintf(pMultipart->type.szContentID, MSG_MSG_ID_LEN + 1, "<%s>", szContentID); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); } if (szContentLocation && szContentLocation[0]) { @@ -409,12 +412,18 @@ msg_error_t MmsMakeMultipartThumbnailInfo(MMS_MULTIPART_DATA_S *pMultipart, char else strncpy(szFileNameWoExt, pszOrgFileName + 1, sizeof(szFileNameWoExt)); } - snprintf(szFileName, MSG_FILENAME_LEN_MAX+1, "thumb_msg_%s", szFileNameWoExt); + int wrn = snprintf(szFileName, MSG_FILENAME_LEN_MAX+1, "thumb_msg_%s", szFileNameWoExt); + if(wrn<0) + MSG_DEBUG("snprintf for szFileName was failed"); if (pszExt && !strcasecmp(pszExt, ".png")) { - snprintf(thumbPath, MSG_FILEPATH_LEN_MAX, "%s%s.png", MSG_THUMBNAIL_PATH, szFileName); + wrn = snprintf(thumbPath, MSG_FILEPATH_LEN_MAX, "%s%s.png", MSG_THUMBNAIL_PATH, szFileName); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); } else { - snprintf(thumbPath, MSG_FILEPATH_LEN_MAX, "%s%s.jpg", MSG_THUMBNAIL_PATH, szFileName); + wrn = snprintf(thumbPath, MSG_FILEPATH_LEN_MAX, "%s%s.jpg", MSG_THUMBNAIL_PATH, szFileName); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); } if (MakeThumbnail(pMultipart->szFilePath, thumbPath) == true) { @@ -752,6 +761,7 @@ bool MmsConvertMsgData(MmsMsg *pMsg, MMS_MESSAGE_DATA_S *pMmsMsg) pMmsMsg->transitionCnt = 0; pMmsMsg->metaCnt = 0; memset(pMmsMsg->szSmilFilePath, 0, MSG_FILEPATH_LEN_MAX); + int wrn=0; if (pMsg->mmsAttrib.contentType == MIME_MULTIPART_RELATED || pMsg->mmsAttrib.contentType == MIME_APPLICATION_VND_WAP_MULTIPART_RELATED) { char *pSmilDoc = NULL; @@ -764,10 +774,18 @@ bool MmsConvertMsgData(MmsMsg *pMsg, MMS_MESSAGE_DATA_S *pMmsMsg) pMmsMsg->smil.type = MIME_APPLICATION_SMIL; snprintf(pMmsMsg->smil.szContentType, MSG_MSG_ID_LEN, "%s", MimeGetMimeStringFromMimeInt(pMsg->msgBody.presentationType.type)); - snprintf(pMmsMsg->smil.szContentID, MSG_MSG_ID_LEN, "%s", pMsg->msgBody.presentationType.szContentID); - snprintf(pMmsMsg->smil.szContentLocation, MSG_MSG_ID_LEN, "%s", pMsg->msgBody.presentationType.szContentLocation); - snprintf(pMmsMsg->smil.szFileName, MSG_FILENAME_LEN_MAX, "%s", pMsg->msgBody.presentationType.param.szName); - snprintf(pMmsMsg->smil.szFilePath, MSG_FILEPATH_LEN_MAX, "%s%s", MSG_DATA_PATH, pMsg->msgBody.presentationType.param.szFileName); + int wrn = snprintf(pMmsMsg->smil.szContentID, MSG_MSG_ID_LEN, "%s", pMsg->msgBody.presentationType.szContentID); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); + wrn = snprintf(pMmsMsg->smil.szContentLocation, MSG_MSG_ID_LEN, "%s", pMsg->msgBody.presentationType.szContentLocation); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); + wrn = snprintf(pMmsMsg->smil.szFileName, MSG_FILENAME_LEN_MAX, "%s", pMsg->msgBody.presentationType.param.szName); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); + wrn = snprintf(pMmsMsg->smil.szFilePath, MSG_FILEPATH_LEN_MAX, "%s%s", MSG_DATA_PATH, pMsg->msgBody.presentationType.param.szFileName); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); } } else { MSG_DEBUG("Not Exist pPresentationBody"); @@ -793,7 +811,9 @@ bool MmsConvertMsgData(MmsMsg *pMsg, MMS_MESSAGE_DATA_S *pMmsMsg) MMS_MEDIA_S *media = NULL; snprintf(szBuf, sizeof(szBuf), "%s", partHeader.param.szFileName); - snprintf(partHeader.param.szFileName, sizeof(partHeader.param.szFileName), "%s%s", MSG_DATA_PATH, szBuf); + wrn = snprintf(partHeader.param.szFileName, sizeof(partHeader.param.szFileName), "%s%s", MSG_DATA_PATH, szBuf); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); page = (MMS_PAGE_S *)calloc(1, sizeof(MMS_PAGE_S)); if (page == NULL) { @@ -809,10 +829,18 @@ bool MmsConvertMsgData(MmsMsg *pMsg, MMS_MESSAGE_DATA_S *pMmsMsg) } media->mediatype = MMS_SMIL_MEDIA_TEXT; - snprintf(media->szFilePath, sizeof(media->szFilePath), "%s", partHeader.param.szFileName); - snprintf(media->szFileName, sizeof(media->szFileName), "%s", partHeader.param.szName); - snprintf(media->szContentID, sizeof(media->szContentID), "%s", partHeader.szContentID); - snprintf(media->szContentLocation, sizeof(media->szContentLocation), "%s", partHeader.szContentLocation); + wrn = snprintf(media->szFilePath, sizeof(media->szFilePath), "%s", partHeader.param.szFileName); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); + wrn = snprintf(media->szFileName, sizeof(media->szFileName), "%s", partHeader.param.szName); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); + wrn = snprintf(media->szContentID, sizeof(media->szContentID), "%s", partHeader.szContentID); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); + wrn = snprintf(media->szContentLocation, sizeof(media->szContentLocation), "%s", partHeader.szContentLocation); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); _MsgMmsAddMedia(page, media); @@ -835,11 +863,21 @@ bool MmsConvertMsgData(MmsMsg *pMsg, MMS_MESSAGE_DATA_S *pMmsMsg) pMultipart.type = (MimeType)multipart->type.type; MSG_DEBUG("Mime Type : %s :%d", MimeGetMimeStringFromMimeInt(multipart->type.type), multipart->type.type); - snprintf(pMultipart.szContentID, sizeof(pMultipart.szContentID), "%s", multipart->type.szContentID); - snprintf(pMultipart.szContentLocation, sizeof(pMultipart.szContentLocation), "%s", multipart->type.szContentLocation); - snprintf(pMultipart.szFileName, sizeof(pMultipart.szFileName), "%s", multipart->type.param.szName); - snprintf(pMultipart.szFilePath, sizeof(pMultipart.szFilePath), "%s", multipart->pBody->szOrgFilePath); - snprintf(pMultipart.szContentType, sizeof(pMultipart.szContentType), "%s", MimeGetMimeStringFromMimeInt(multipart->type.type)); + wrn = snprintf(pMultipart.szContentID, sizeof(pMultipart.szContentID), "%s", multipart->type.szContentID); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); + wrn = snprintf(pMultipart.szContentLocation, sizeof(pMultipart.szContentLocation), "%s", multipart->type.szContentLocation); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); + wrn = snprintf(pMultipart.szFileName, sizeof(pMultipart.szFileName), "%s", multipart->type.param.szName); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); + wrn = snprintf(pMultipart.szFilePath, sizeof(pMultipart.szFilePath), "%s", multipart->pBody->szOrgFilePath); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); + wrn = snprintf(pMultipart.szContentType, sizeof(pMultipart.szContentType), "%s", MimeGetMimeStringFromMimeInt(multipart->type.type)); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); if (multipart->type.drmInfo.drmType != MSG_DRM_TYPE_NONE) { pMultipart.drmType = multipart->type.drmInfo.drmType; @@ -948,13 +986,22 @@ int MmsUpdatePreviewData(MSG_MESSAGE_INFO_S *pMsgInfo) bool MmsConvertMmsData(MmsMsg *pMmsMsg, MMS_DATA_S *pMmsData) { MSG_BEGIN(); + int wrn =0; MMS_HEADER_DATA_S *pHeaderData = pMmsData->header; if (pHeaderData) { - snprintf(pHeaderData->messageID, sizeof(pHeaderData->messageID), "%s", pMmsMsg->szMsgID); - snprintf(pHeaderData->trID, sizeof(pHeaderData->trID), "%s", pMmsMsg->szTrID); - snprintf(pHeaderData->contentLocation, sizeof(pHeaderData->contentLocation), "%s", pMmsMsg->szContentLocation); - snprintf(pHeaderData->szContentType, sizeof(pHeaderData->szContentType), "%s", MimeGetMimeStringFromMimeInt(pMmsMsg->mmsAttrib.contentType)); + wrn = snprintf(pHeaderData->messageID, sizeof(pHeaderData->messageID), "%s", pMmsMsg->szMsgID); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); + wrn = snprintf(pHeaderData->trID, sizeof(pHeaderData->trID), "%s", pMmsMsg->szTrID); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); + wrn = snprintf(pHeaderData->contentLocation, sizeof(pHeaderData->contentLocation), "%s", pMmsMsg->szContentLocation); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); + wrn = snprintf(pHeaderData->szContentType, sizeof(pHeaderData->szContentType), "%s", MimeGetMimeStringFromMimeInt(pMmsMsg->mmsAttrib.contentType)); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); pHeaderData->messageType = pMmsMsg->mmsAttrib.msgType; pHeaderData->mmsVersion = pMmsMsg->mmsAttrib.version; @@ -971,13 +1018,17 @@ bool MmsConvertMmsData(MmsMsg *pMmsMsg, MMS_DATA_S *pMmsData) pHeaderData->bReadReport = pMmsMsg->mmsAttrib.bAskReadReply; pHeaderData->bHideAddress = pMmsMsg->mmsAttrib.bHideAddress; - snprintf(pHeaderData->szSubject, sizeof(pHeaderData->szSubject), "%s", pMmsMsg->mmsAttrib.szSubject); + wrn = snprintf(pHeaderData->szSubject, sizeof(pHeaderData->szSubject), "%s", pMmsMsg->mmsAttrib.szSubject); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); pHeaderData->to = MmsConvertAddressToNewStyle(pMmsMsg->mmsAttrib.szTo); pHeaderData->cc = MmsConvertAddressToNewStyle(pMmsMsg->mmsAttrib.szCc); pHeaderData->bcc = MmsConvertAddressToNewStyle(pMmsMsg->mmsAttrib.szBcc); - snprintf(pHeaderData->szFrom, sizeof(pHeaderData->szFrom), "%s", pMmsMsg->mmsAttrib.szFrom); + wrn = snprintf(pHeaderData->szFrom, sizeof(pHeaderData->szFrom), "%s", pMmsMsg->mmsAttrib.szFrom); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); } /* single part item */ @@ -986,11 +1037,21 @@ bool MmsConvertMmsData(MmsMsg *pMmsMsg, MMS_DATA_S *pMmsData) MMS_MULTIPART_DATA_S *pMultipart = MsgMmsCreateMultipart(); if (pMultipart) { pMultipart->type = pMmsMsg->mmsAttrib.contentType; - snprintf(pMultipart->szContentType, sizeof(pMultipart->szContentType), "%s", MimeGetMimeStringFromMimeInt(pMultipart->type)); - snprintf(pMultipart->szContentID, sizeof(pMultipart->szContentID), "%s", pMmsMsg->msgType.szContentID); - snprintf(pMultipart->szContentLocation, sizeof(pMultipart->szContentLocation), "%s", pMmsMsg->msgType.szContentLocation); - snprintf(pMultipart->szFileName, sizeof(pMultipart->szFileName), "%s", pMmsMsg->msgType.param.szName); - snprintf(pMultipart->szFilePath, sizeof(pMultipart->szFilePath), "%s", pMmsMsg->msgBody.szOrgFilePath); + wrn = snprintf(pMultipart->szContentType, sizeof(pMultipart->szContentType), "%s", MimeGetMimeStringFromMimeInt(pMultipart->type)); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); + wrn = snprintf(pMultipart->szContentID, sizeof(pMultipart->szContentID), "%s", pMmsMsg->msgType.szContentID); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); + wrn = snprintf(pMultipart->szContentLocation, sizeof(pMultipart->szContentLocation), "%s", pMmsMsg->msgType.szContentLocation); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); + wrn = snprintf(pMultipart->szFileName, sizeof(pMultipart->szFileName), "%s", pMmsMsg->msgType.param.szName); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); + wrn = snprintf(pMultipart->szFilePath, sizeof(pMultipart->szFilePath), "%s", pMmsMsg->msgBody.szOrgFilePath); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); pMultipart->drmType = pMmsMsg->msgType.drmInfo.drmType; pMmsData->multipartlist = g_list_append(pMmsData->multipartlist, pMultipart); @@ -1003,11 +1064,21 @@ bool MmsConvertMmsData(MmsMsg *pMmsMsg, MMS_DATA_S *pMmsData) MMS_MULTIPART_DATA_S *pMultipart = MsgMmsCreateMultipart(); if (pMultipart) { pMultipart->type = MIME_APPLICATION_SMIL; - snprintf(pMultipart->szContentType, sizeof(pMultipart->szContentType), "%s", "application/smil"); - snprintf(pMultipart->szContentID, sizeof(pMultipart->szContentID), "%s", pMmsMsg->msgBody.presentationType.szContentID); - snprintf(pMultipart->szContentLocation, sizeof(pMultipart->szContentLocation), "%s", pMmsMsg->msgBody.presentationType.szContentLocation); - snprintf(pMultipart->szFileName, sizeof(pMultipart->szFileName), "%s", pMmsMsg->msgBody.presentationType.param.szName); - snprintf(pMultipart->szFilePath, sizeof(pMultipart->szFilePath), "%s%s", MSG_DATA_PATH, pMmsMsg->msgBody.presentationType.param.szFileName); + wrn = snprintf(pMultipart->szContentType, sizeof(pMultipart->szContentType), "%s", "application/smil"); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); + wrn = snprintf(pMultipart->szContentID, sizeof(pMultipart->szContentID), "%s", pMmsMsg->msgBody.presentationType.szContentID); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); + wrn = snprintf(pMultipart->szContentLocation, sizeof(pMultipart->szContentLocation), "%s", pMmsMsg->msgBody.presentationType.szContentLocation); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); + wrn = snprintf(pMultipart->szFileName, sizeof(pMultipart->szFileName), "%s", pMmsMsg->msgBody.presentationType.param.szName); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); + wrn = snprintf(pMultipart->szFilePath, sizeof(pMultipart->szFilePath), "%s%s", MSG_DATA_PATH, pMmsMsg->msgBody.presentationType.param.szFileName); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); pMmsData->smil = pMultipart; } @@ -1024,11 +1095,21 @@ bool MmsConvertMmsData(MmsMsg *pMmsMsg, MMS_DATA_S *pMmsData) if (pMultipart) { pMultipart->type = (MimeType)multipart->type.type; - snprintf(pMultipart->szContentType, sizeof(pMultipart->szContentType), "%s", MimeGetMimeStringFromMimeInt(multipart->type.type)); - snprintf(pMultipart->szContentID, sizeof(pMultipart->szContentID), "%s", multipart->type.szContentID); - snprintf(pMultipart->szContentLocation, sizeof(pMultipart->szContentLocation), "%s", multipart->type.szContentLocation); - snprintf(pMultipart->szFileName, sizeof(pMultipart->szFileName), "%s", multipart->type.param.szName); - snprintf(pMultipart->szFilePath, sizeof(pMultipart->szFilePath), "%s", multipart->pBody->szOrgFilePath); + wrn = snprintf(pMultipart->szContentType, sizeof(pMultipart->szContentType), "%s", MimeGetMimeStringFromMimeInt(multipart->type.type)); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); + wrn = snprintf(pMultipart->szContentID, sizeof(pMultipart->szContentID), "%s", multipart->type.szContentID); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); + wrn = snprintf(pMultipart->szContentLocation, sizeof(pMultipart->szContentLocation), "%s", multipart->type.szContentLocation); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); + wrn = snprintf(pMultipart->szFileName, sizeof(pMultipart->szFileName), "%s", multipart->type.param.szName); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); + wrn = snprintf(pMultipart->szFilePath, sizeof(pMultipart->szFilePath), "%s", multipart->pBody->szOrgFilePath); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); pMultipart->drmType = multipart->type.drmInfo.drmType; pMmsData->multipartlist = g_list_append(pMmsData->multipartlist, pMultipart); @@ -1049,6 +1130,7 @@ bool MmsConvertMmsMsg(MmsMsg *pMmsMsg, MMS_DATA_S *pMmsData) MmsInitMsgAttrib(&pMmsMsg->mmsAttrib); MmsInitMsgType(&pMmsMsg->msgType); MmsInitMsgBody(&pMmsMsg->msgBody); + int wrn = 0; pMmsMsg->mmsAttrib.dataType = MMS_DATATYPE_DRAFT; @@ -1070,7 +1152,9 @@ bool MmsConvertMmsMsg(MmsMsg *pMmsMsg, MMS_DATA_S *pMmsData) pMmsMsg->mmsAttrib.msgClass = (MmsMsgClass)pHeaderData->messageClass; if (strlen(pHeaderData->messageID) > 0) { - snprintf(pMmsMsg->szMsgID, sizeof(pMmsMsg->szMsgID), "%s", pHeaderData->messageID); + wrn = snprintf(pMmsMsg->szMsgID, sizeof(pMmsMsg->szMsgID), "%s", pHeaderData->messageID); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); } pMmsMsg->mmsAttrib.msgType = (MmsMsgType)pHeaderData->messageType; @@ -1080,17 +1164,23 @@ bool MmsConvertMmsMsg(MmsMsg *pMmsMsg, MMS_DATA_S *pMmsData) pMmsMsg->mmsAttrib.bHideAddress = pHeaderData->bHideAddress; if (strlen(pHeaderData->trID) > 0) { - snprintf(pMmsMsg->szTrID, sizeof(pMmsMsg->szTrID), "%s", pHeaderData->trID); + wrn = snprintf(pMmsMsg->szTrID, sizeof(pMmsMsg->szTrID), "%s", pHeaderData->trID); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); } - snprintf(pMmsMsg->mmsAttrib.szSubject, sizeof(pMmsMsg->mmsAttrib.szSubject), "%s", pHeaderData->szSubject); + wrn = snprintf(pMmsMsg->mmsAttrib.szSubject, sizeof(pMmsMsg->mmsAttrib.szSubject), "%s", pHeaderData->szSubject); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); pMmsMsg->mmsAttrib.szTo = MmsConvertAddressToOldStyle(pHeaderData->to); pMmsMsg->mmsAttrib.szCc = MmsConvertAddressToOldStyle(pHeaderData->cc); pMmsMsg->mmsAttrib.szBcc = MmsConvertAddressToOldStyle(pHeaderData->bcc); - snprintf(pMmsMsg->mmsAttrib.szFrom, sizeof(pMmsMsg->mmsAttrib.szFrom), "%s", pHeaderData->szFrom); + wrn = snprintf(pMmsMsg->mmsAttrib.szFrom, sizeof(pMmsMsg->mmsAttrib.szFrom), "%s", pHeaderData->szFrom); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); } /* CID 41988: Moving all de-referencing of pHeaderData inside null-check block */ printMmsAttribute(&pMmsMsg->mmsAttrib); @@ -1338,14 +1428,25 @@ bool convertAttachToMultipart(MMS_ATTACH_S *pSrcMedia, MMS_MULTIPART_DATA_S *pDe bool convertMsgMultipartToMultipart(MsgMultipart *pSrcMultipart, MMS_MULTIPART_DATA_S *pDestMultipart) { pDestMultipart->type = (MimeType)pSrcMultipart->type.type; + int wrn =0; MSG_DEBUG("Mime Type : %s :%d", MimeGetMimeStringFromMimeInt(pSrcMultipart->type.type), pSrcMultipart->type.type); - snprintf(pDestMultipart->szContentID, sizeof(pDestMultipart->szContentID), "%s", pSrcMultipart->type.szContentID); - snprintf(pDestMultipart->szContentLocation, sizeof(pDestMultipart->szContentLocation), "%s", pSrcMultipart->type.szContentLocation); - snprintf(pDestMultipart->szFileName, sizeof(pDestMultipart->szFileName), "%s", pSrcMultipart->type.param.szName); - snprintf(pDestMultipart->szFilePath, sizeof(pDestMultipart->szFilePath), "%s", pSrcMultipart->pBody->szOrgFilePath); - - snprintf(pDestMultipart->szContentType, sizeof(pDestMultipart->szContentType), "%s", MimeGetMimeStringFromMimeInt(pSrcMultipart->type.type)); + wrn = snprintf(pDestMultipart->szContentID, sizeof(pDestMultipart->szContentID), "%s", pSrcMultipart->type.szContentID); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); + wrn = snprintf(pDestMultipart->szContentLocation, sizeof(pDestMultipart->szContentLocation), "%s", pSrcMultipart->type.szContentLocation); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); + wrn = snprintf(pDestMultipart->szFileName, sizeof(pDestMultipart->szFileName), "%s", pSrcMultipart->type.param.szName); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); + wrn = snprintf(pDestMultipart->szFilePath, sizeof(pDestMultipart->szFilePath), "%s", pSrcMultipart->pBody->szOrgFilePath); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); + + wrn = snprintf(pDestMultipart->szContentType, sizeof(pDestMultipart->szContentType), "%s", MimeGetMimeStringFromMimeInt(pSrcMultipart->type.type)); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); if (pSrcMultipart->type.drmInfo.drmType != MSG_DRM_TYPE_NONE) { pDestMultipart->drmType = pSrcMultipart->type.drmInfo.drmType; diff --git a/plugin/mms_plugin/MmsPluginStorage.cpp b/plugin/mms_plugin/MmsPluginStorage.cpp index f77d63a..4844c51 100755 --- a/plugin/mms_plugin/MmsPluginStorage.cpp +++ b/plugin/mms_plugin/MmsPluginStorage.cpp @@ -754,7 +754,9 @@ msg_error_t MmsPluginStorage::deleteMmsMessage(int msgId) if (dbHandle->stepQuery() == MSG_ERR_DB_ROW) { strncpy(filePath, (char *)dbHandle->columnText(0), MSG_FILEPATH_LEN_MAX); - snprintf(dirPath, MSG_FILEPATH_LEN_MAX, "%s.dir", filePath); + int wrn = snprintf(dirPath, MSG_FILEPATH_LEN_MAX, "%s.dir", filePath); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); /* delete pdu file */ if (remove(filePath) == -1) @@ -803,6 +805,7 @@ msg_error_t MmsPluginStorage::insertMultipart(msg_message_id_t msgId, MMS_MULTIP MSG_BEGIN(); MsgDbHandler *dbHandle = getDbHandle(); + int wrn =0; char sqlQuery[MAX_QUERY_LEN + 1]; memset(sqlQuery, 0x00, sizeof(sqlQuery)); @@ -834,10 +837,12 @@ msg_error_t MmsPluginStorage::insertMultipart(msg_message_id_t msgId, MMS_MULTIP #else if (pMultipart->type == MIME_APPLICATION_SMIL) { /* Smil */ - snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s " + wrn = snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s " "(MSG_ID, SEQ, CONTENT_TYPE, NAME, CONTENT_ID, CONTENT_LOCATION, FILE_PATH) " "VALUES (%d, -1, \"%s\", \"%s\", \"%s\", \"%s\", \"%s\");", MSGFW_MMS_MULTIPART_TABLE_NAME, msgId, pMultipart->szContentType, pMultipart->szFileName, pMultipart->szContentID, pMultipart->szContentLocation, (char *)pMultipart->szFilePath); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); MSG_SEC_DEBUG("QUERY : [%s]", sqlQuery); @@ -884,10 +889,12 @@ msg_error_t MmsPluginStorage::insertMultipart(msg_message_id_t msgId, MMS_MULTIP g_file_get_contents((gchar*)pMultipart->szFilePath, (gchar**)&contents, (gsize*)&length, NULL); if (contents) { - snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s " + wrn = snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s " "(MSG_ID, CONTENT_TYPE, NAME, CONTENT_ID, CONTENT_LOCATION, FILE_PATH, TCS_LEVEL, MALWARE_ALLOW, TEXT) " "VALUES (%d, \"%s\", \"%s\", \"%s\", \"%s\", \"%s\", '%d', '%d', ?);", MSGFW_MMS_MULTIPART_TABLE_NAME, msgId, pMultipart->szContentType, pMultipart->szFileName, pMultipart->szContentID, pMultipart->szContentLocation, pMultipart->szFilePath, pMultipart->tcs_bc_level, pMultipart->malware_allow); + if(wrn<0) + MSG_DEBUG("snprintf for pMmsMsg->smil.szFilePath was failed"); MSG_SEC_DEBUG("QUERY : [%s]", sqlQuery); @@ -910,10 +917,12 @@ msg_error_t MmsPluginStorage::insertMultipart(msg_message_id_t msgId, MMS_MULTIP MSG_ERR("file contents is null!"); } } else { - snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s " + wrn = snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s " "(MSG_ID, CONTENT_TYPE, NAME, CONTENT_ID, CONTENT_LOCATION, FILE_PATH, TCS_LEVEL, MALWARE_ALLOW, THUMB_FILE_PATH) " "VALUES (%d, \"%s\", \"%s\", \"%s\", \"%s\" ,\"%s\", '%d', '%d', \"%s\");", MSGFW_MMS_MULTIPART_TABLE_NAME, msgId, pMultipart->szContentType, pMultipart->szFileName, pMultipart->szContentID, pMultipart->szContentLocation, pMultipart->szFilePath, pMultipart->tcs_bc_level, pMultipart->malware_allow, pMultipart->szThumbFilePath); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); MSG_SEC_DEBUG("QUERY : [%s]", sqlQuery); diff --git a/plugin/mms_plugin/MmsPluginUserAgent.cpp b/plugin/mms_plugin/MmsPluginUserAgent.cpp index 3bc8c9c..8a5e49a 100755 --- a/plugin/mms_plugin/MmsPluginUserAgent.cpp +++ b/plugin/mms_plugin/MmsPluginUserAgent.cpp @@ -653,6 +653,7 @@ void MmsPluginUaManager::addMmsReqEntity(mmsTranQEntity *req) bool MmsPluginUaManager::processReceivedData(int msgId, char *pRcvdBody, int rcvdBodyLen, char *retrievedFilePath) { MSG_BEGIN(); + int wrn=0; /* CID 317909 : replacing MSG_FILENAME_LEN_MAX with MAX_FULL_PATH_SIZE as the latter is max length for internal file path * and size of retrievedFilePath in calling function is same i.e. MAX_FULL_PATH_SIZE+1 @@ -671,7 +672,9 @@ bool MmsPluginUaManager::processReceivedData(int msgId, char *pRcvdBody, int rcv /* CID 317909 : replacing MSG_FILENAME_LEN_MAX with MAX_FULL_PATH_SIZE as the latter is max length for internal file path * and size of retrievedFilePath in calling function is same i.e. MAX_FULL_PATH_SIZE+1 * snprintf(retrievedFilePath, MSG_FILEPATH_LEN_MAX, "%s%s", MSG_DATA_PATH, fileName); */ - snprintf(retrievedFilePath, MAX_FULL_PATH_SIZE, "%s%s", MSG_DATA_PATH, fileName); + wrn = snprintf(retrievedFilePath, MAX_FULL_PATH_SIZE, "%s%s", MSG_DATA_PATH, fileName); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); MSG_SEC_INFO("retrievedFilePaths [%s]", retrievedFilePath); diff --git a/plugin/sms_plugin/SmsPluginSatHandler.cpp b/plugin/sms_plugin/SmsPluginSatHandler.cpp index 8a40e70..b318ce6 100755 --- a/plugin/sms_plugin/SmsPluginSatHandler.cpp +++ b/plugin/sms_plugin/SmsPluginSatHandler.cpp @@ -181,7 +181,9 @@ void SmsPluginSatHandler::sendSms(TapiHandle *handle, void *pData) if (pSmsData->address.diallingNumberLen > 0) { smsc.ton = pSmsData->address.ton; smsc.npi = pSmsData->address.npi; - snprintf(smsc.address, sizeof(smsc.address), "%s", pSmsData->address.diallingNumber); + int wrn = snprintf(smsc.address, sizeof(smsc.address), "%s", pSmsData->address.diallingNumber); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); MSG_SEC_DEBUG("SCA TON[%d], NPI[%d], LEN[%zu], ADDR[%s]", smsc.ton, smsc.npi, strlen(smsc.address), smsc.address); } else { diff --git a/plugin/sms_plugin/SmsPluginWapPushHandler.cpp b/plugin/sms_plugin/SmsPluginWapPushHandler.cpp index 47d0da9..85bb6df 100755 --- a/plugin/sms_plugin/SmsPluginWapPushHandler.cpp +++ b/plugin/sms_plugin/SmsPluginWapPushHandler.cpp @@ -2759,7 +2759,9 @@ void SmsPluginWapPushHandler::wspDecodeHeader(unsigned char* sEncodedHeader, uns iField = AcStrlen((char*)authScheme) + 1; strncpy((char*)realmValue, (char*)(fieldValue + iField), WSP_STANDARD_STR_LEN_MAX-1); iField = iField + AcStrlen((char*)realmValue) + 1; - snprintf((char*)addedString, sizeof(addedString), "%s %s", authScheme, realmValue); + int wrn = snprintf((char*)addedString, sizeof(addedString), "%s %s", authScheme, realmValue); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); wspHeaderCopyDecodedString(addedString, ¤tLength, &temper); if (iField < fieldValueLen) { @@ -2905,7 +2907,9 @@ void SmsPluginWapPushHandler::wspDecodeHeader(unsigned char* sEncodedHeader, uns strncpy((char*)agent, (char*)(fieldValue + iField), WSP_STANDARD_STR_LEN_MAX-1); iField = iField + AcStrlen((char*)agent) + 1; strncpy((char*)text, (char*)(fieldValue + iField), WSP_STANDARD_STR_LEN_MAX-1); - snprintf((char*)temp, sizeof(temp), " %s %s", agent, text); + int wrn = snprintf((char*)temp, sizeof(temp), " %s %s", agent, text); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); wspHeaderCopyDecodedString(temp, ¤tLength, &temper); } } @@ -3383,7 +3387,9 @@ void SmsPluginWapPushHandler::wspHeaderDecodeAuth(unsigned long fieldValueLen, u snprintf(authStr, sizeof(authStr), "%%%zus", sizeof(passWd)); sscanf((char*)(fieldValue + iField), authStr, passWd); iField = iField + AcStrlen((char*)userId) + 1; - snprintf((char*)*pDecodedString, (sizeof(char)*WSP_STANDARD_STR_LEN_MAX*2), "basic %s/%s", userId, passWd); + int wrn = snprintf((char*)*pDecodedString, (sizeof(char)*WSP_STANDARD_STR_LEN_MAX*2), "basic %s/%s", userId, passWd); + if(wrn<0) + MSG_DEBUG("snprintf was failed\n"); return; } @@ -3409,7 +3415,9 @@ void SmsPluginWapPushHandler::wspHeaderDecodeChallenge(unsigned long fieldValueL sscanf((char*)(fieldValue + iField), authStr, userId); iField = iField + AcStrlen((char*)userId) + 1; - snprintf((char*)*pDecodedString, (sizeof(char)*WSP_STANDARD_STR_LEN_MAX), "basic realm=\"%s\"", userId); + int wrn = snprintf((char*)*pDecodedString, (sizeof(char)*WSP_STANDARD_STR_LEN_MAX), "basic realm=\"%s\"", userId); + if(wrn<0) + MSG_DEBUG("snprintf was failed\n"); return; } @@ -3419,6 +3427,7 @@ void SmsPluginWapPushHandler::wspHeaderDecodeCacheControl(unsigned char* fieldVa { unsigned char paramString[WSP_STANDARD_STR_LEN_MAX]; unsigned char cacheCode; + int wrn =0; *pCacheString = new char[WSP_STANDARD_STR_LEN_MAX]; if (*pCacheString == NULL) { @@ -3466,7 +3475,9 @@ void SmsPluginWapPushHandler::wspHeaderDecodeCacheControl(unsigned char* fieldVa default : break; } - snprintf((char*)*pCacheString, (sizeof(char)*WSP_STANDARD_STR_LEN_MAX), "%s=%s", (char*)wspCacheControl[cacheCode], (char*)paramString); + wrn = snprintf((char*)*pCacheString, (sizeof(char)*WSP_STANDARD_STR_LEN_MAX), "%s=%s", (char*)wspCacheControl[cacheCode], (char*)paramString); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); } else { /* cache extentions */ /* In case of come directive of doesn't specified string style */ diff --git a/utils/MsgMmsMessage.cpp b/utils/MsgMmsMessage.cpp index 5caca09..01af049 100755 --- a/utils/MsgMmsMessage.cpp +++ b/utils/MsgMmsMessage.cpp @@ -1521,7 +1521,9 @@ int MsgMmsSetMultipartFilePath(const char *dirPath, MMS_MULTIPART_DATA_S *pMulti memset(pMultipart->szFilePath, 0x00, sizeof(pMultipart->szFilePath)); - snprintf(pMultipart->szFilePath, sizeof(pMultipart->szFilePath), "%s/%s", dirPath, pMultipart->szFileName); + int wrn = snprintf(pMultipart->szFilePath, sizeof(pMultipart->szFilePath), "%s/%s", dirPath, pMultipart->szFileName); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); /* remove space character of original file name */ msg_replace_space_char(pMultipart->szFilePath); diff --git a/utils/MsgSmil.cpp b/utils/MsgSmil.cpp index 031f437..2f31c45 100755 --- a/utils/MsgSmil.cpp +++ b/utils/MsgSmil.cpp @@ -1076,7 +1076,9 @@ xmlNode *MsgSmilCreateTextNode(MMS_MEDIA_S *pstSmilMedia, char *pszContentID) } if (strlen(pstSmilMedia->szAlt) > 0) { - snprintf (szBuf, sizeof(szBuf), "%s", pstSmilMedia->szAlt); + int wrn = snprintf (szBuf, sizeof(szBuf), "%s", pstSmilMedia->szAlt); + if(wrn<0) + MSG_DEBUG("snprintf was failed\n"); xmlSetProp(pstMedia, (const xmlChar *)"alt", (const xmlChar *)szBuf); MSG_DEBUG("[Set Attribute] Alternate : [%s]", szBuf); } @@ -1259,7 +1261,9 @@ xmlNode *MsgSmilCreateMMNode(MMS_MEDIA_S *pstSmilMedia, char *pszContentID) } if (strlen(pstSmilMedia->szAlt) > 0) { - snprintf (szBuf, sizeof(szBuf), "%s", pstSmilMedia->szAlt); + int wrn = snprintf (szBuf, sizeof(szBuf), "%s", pstSmilMedia->szAlt); + if(wrn<0) + MSG_DEBUG("snprintf was failed\n"); xmlSetProp(pstMedia, (const xmlChar *)"alt", (const xmlChar *)szBuf); MSG_DEBUG("[Set Attribute] alt : [%s]", szBuf); } diff --git a/utils/MsgUtilStorage.cpp b/utils/MsgUtilStorage.cpp index b025f95..f5bbdb7 100755 --- a/utils/MsgUtilStorage.cpp +++ b/utils/MsgUtilStorage.cpp @@ -3072,6 +3072,7 @@ msg_error_t MsgStoGetMediaList(const msg_thread_id_t threadId, msg_list_handle_t dbHandle->connectReadOnly(); char sqlQuery[MAX_QUERY_LEN+1]; int msgIdCnt = 0; + int wrn =0; memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID FROM %s WHERE MAIN_TYPE = %d AND DPM_RESTRICTED = 0 AND CONV_ID = %d;", @@ -3141,9 +3142,15 @@ msg_error_t MsgStoGetMediaList(const msg_thread_id_t threadId, msg_list_handle_t pMedia->msg_id = msg_id; pMedia->tcs_level = tcs_level; pMedia->malware_allow = malware_allow; - snprintf(pMedia->mime_type, MAX_MIME_TYPE_LEN, "%s", mime_type); - snprintf(pMedia->media_item, MSG_FILEPATH_LEN_MAX, "%s", media_item); - snprintf(pMedia->thumb_path, MSG_FILEPATH_LEN_MAX, "%s", thumb_path); + wrn = snprintf(pMedia->mime_type, MAX_MIME_TYPE_LEN, "%s", mime_type); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); + wrn = snprintf(pMedia->media_item, MSG_FILEPATH_LEN_MAX, "%s", media_item); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); + wrn = snprintf(pMedia->thumb_path, MSG_FILEPATH_LEN_MAX, "%s", thumb_path); + if(wrn<0) + MSG_DEBUG("snprintf was failed"); pMedia->thumb_tcs_level = thumb_tcs_level; pMedia->thumb_malware_allow = thumb_malware_allow; diff --git a/utils/MsgVMessage.cpp b/utils/MsgVMessage.cpp index 43f52dd..ba17cdd 100755 --- a/utils/MsgVMessage.cpp +++ b/utils/MsgVMessage.cpp @@ -461,13 +461,15 @@ char* _convert_tm_to_vdata_str(const struct tm * tm) { char str[17] = {0, }; - snprintf(str, 17, "%04d%02d%02dT%02d%02d%02dZ", + int wrn = snprintf(str, 17, "%04d%02d%02dT%02d%02d%02dZ", tm->tm_year + 1900, tm->tm_mon +1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec); + if(wrn < 0) + MSG_DEBUG("snprintf was failed "); return strdup(str); } @@ -548,11 +550,12 @@ char* __msgsvc_vmsg_convert_tm_to_vdata_str(struct tm * tm) int mon = 0; int hour = 0; mon = tm->tm_mon + 1; + int wrn=0; if (tm->tm_hour >= 12) - strncpy(APM, "PM", 2); + strncpy(APM, "PM", 3); else - strncpy(APM, "AM", 2); + strncpy(APM, "AM", 3); if (tm->tm_hour > 12) hour = tm->tm_hour - 12; @@ -561,53 +564,55 @@ char* __msgsvc_vmsg_convert_tm_to_vdata_str(struct tm * tm) switch(mon) { case 1: - strncpy(month, "Jan", 3); + strncpy(month, "Jan", 4); break; case 2: - strncpy(month, "Feb", 3); + strncpy(month, "Feb", 4); break; case 3: - strncpy(month, "Mar", 3); + strncpy(month, "Mar", 4); break; case 4: - strncpy(month, "Apr", 3); + strncpy(month, "Apr", 4); break; case 5: - strncpy(month, "May", 3); + strncpy(month, "May", 4); break; case 6: - strncpy(month, "Jun", 3); + strncpy(month, "Jun", 4); break; case 7: - strncpy(month, "Jul", 3); + strncpy(month, "Jul", 4); break; case 8: - strncpy(month, "Aug", 3); + strncpy(month, "Aug", 4); break; case 9: - strncpy(month, "Sep", 3); + strncpy(month, "Sep", 4); break; case 10: - strncpy(month, "Oct", 3); + strncpy(month, "Oct", 4); break; case 11: - strncpy(month, "Nov", 3); + strncpy(month, "Nov", 4); break; case 12: - strncpy(month, "Dec", 3); + strncpy(month, "Dec", 4); break; default: MSG_DEBUG("invalid month number"); break; } - snprintf(str, 22, "%d:%02d%s, %04d %s %d", + wrn = snprintf(str, 22, "%d:%02d%s, %04d %s %d", hour, tm->tm_min, APM, tm->tm_year + 1900, month, tm->tm_mday); + if(wrn < 0) + MSG_DEBUG("snprintf was failed "); return strdup(str); } |