From: Kyeonghun Lee Date: Mon, 7 Mar 2016 08:06:27 +0000 (+0900) Subject: remove sprintf, strcpy X-Git-Tag: submit/tizen/20160309.053726~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=48c295b616e8d4620667664aaa8dd5ced8e98cfc;p=platform%2Fcore%2Fmessaging%2Fmsg-service.git remove sprintf, strcpy Change-Id: If1ec4ee6088aa98be4ec242b30cb49ae9072f4b7 Signed-off-by: Kyeonghun Lee --- diff --git a/plugin/sms_cdma_plugin/SmsCdmaPluginEventHandler.cpp b/plugin/sms_cdma_plugin/SmsCdmaPluginEventHandler.cpp index 00df541..78b9b42 100755 --- a/plugin/sms_cdma_plugin/SmsCdmaPluginEventHandler.cpp +++ b/plugin/sms_cdma_plugin/SmsCdmaPluginEventHandler.cpp @@ -265,7 +265,7 @@ void SmsPluginEventHandler::convertCMASMsgToMsgInfo(sms_telesvc_deliver_s *p_del memset(p_msg_info->msgText, 0x00, sizeof(p_msg_info->msgText)); p_msg_info->dataSize = 0; } else if (p_deliver->cmas_data.data_len > MAX_MSG_TEXT_LEN) { - sprintf(p_msg_info->msgText, "[Broken Message]"); + snprintf(p_msg_info->msgText, MAX_MSG_TEXT_LEN, "[Broken Message]"); p_msg_info->dataSize = strlen(p_msg_info->msgData); return; } else { @@ -392,7 +392,7 @@ void SmsPluginEventHandler::convertDeliverMsgToMsgInfo(sms_telesvc_deliver_s *p_ memset(p_msg_info->msgText, 0x00, sizeof(p_msg_info->msgText)); p_msg_info->dataSize = 0; } else if (p_deliver->user_data.data_len > MAX_MSG_TEXT_LEN) { - sprintf(p_msg_info->msgText, "[Broken Message]"); + snprintf(p_msg_info->msgText, MAX_MSG_TEXT_LEN, "[Broken Message]"); p_msg_info->dataSize = strlen(p_msg_info->msgData); return; } else { diff --git a/plugin/sms_cdma_plugin/SmsCdmaPluginWapPushHandler.cpp b/plugin/sms_cdma_plugin/SmsCdmaPluginWapPushHandler.cpp index 32147a1..f092d89 100755 --- a/plugin/sms_cdma_plugin/SmsCdmaPluginWapPushHandler.cpp +++ b/plugin/sms_cdma_plugin/SmsCdmaPluginWapPushHandler.cpp @@ -2880,7 +2880,7 @@ void SmsPluginWapPushHandler::wspHeaderDecodeQValue(unsigned long length, unsign if (qValue > 100) { qValue = qValue - 100; qValue = qValue / 1000; - sprintf((char*)*pDecodedString, "; q=%.3f", qValue); + snprintf((char*)*pDecodedString, sizeof(char)*WSP_STANDARD_STR_LEN_MAX, "; q=%.3f", qValue); } else { /* qValue variable is divided by 100. And it's multiplied by 100. It's to resolve problem of changed 0.01 of qValue. */ @@ -2889,9 +2889,9 @@ void SmsPluginWapPushHandler::wspHeaderDecodeQValue(unsigned long length, unsign qValue = qValue / 100; qValueTemp = (unsigned long)(qValue * 100); if (0 == (qValueTemp % 10)) - sprintf((char*)*pDecodedString, "; q=%.1f", qValue); + snprintf((char*)*pDecodedString, sizeof(char)*WSP_STANDARD_STR_LEN_MAX, "; q=%.1f", qValue); else - sprintf((char*)*pDecodedString, "; q=%.2f", qValue); + snprintf((char*)*pDecodedString, sizeof(char)*WSP_STANDARD_STR_LEN_MAX, "; q=%.2f", qValue); } return; } @@ -2985,7 +2985,7 @@ void SmsPluginWapPushHandler::wspHeaderDecodeParameter(unsigned char* data, unsi MSG_DEBUG("WspLHeaderDecodeParameter: 0x03 MemAlloc failed\n"); return; } else { - sprintf((char*)param, "Type=%i", (int)wspHeaderDecodeInteger(data + 1)); + snprintf((char*)param, sizeof(char)*WSP_STANDARD_STR_LEN_MAX, "Type=%i", (int)wspHeaderDecodeInteger(data + 1)); } break; case 0x08: @@ -2995,7 +2995,7 @@ void SmsPluginWapPushHandler::wspHeaderDecodeParameter(unsigned char* data, unsi MSG_DEBUG("WspLHeaderDecodeParameter:0x08 MemAlloc failed\n"); return; } else { - sprintf((char*)param, "Padding=%i", (int)wspHeaderDecodeInteger(data + 1)); + snprintf((char*)param, sizeof(char)*WSP_STANDARD_STR_LEN_MAX, "Padding=%i", (int)wspHeaderDecodeInteger(data + 1)); } break; case 0x05: @@ -3107,7 +3107,7 @@ void SmsPluginWapPushHandler::wspHeaderDecodeVersion(unsigned long length, unsig /* typed version */ unsigned char majorVer = ((data[0] & 0x7f) >> 4); unsigned char minorVer = data[0] & 0x0f; - sprintf((char*)*pDecodedString, "level=%u.%u", majorVer, minorVer); + snprintf((char*)*pDecodedString, sizeof(char)*WSP_STANDARD_STR_LEN_MAX, "level=%u.%u", majorVer, minorVer); } return;