diff options
author | Keebum Kim <keebum.kim@samsung.com> | 2013-01-31 20:21:25 +0900 |
---|---|---|
committer | Keebum Kim <keebum.kim@samsung.com> | 2013-01-31 20:21:25 +0900 |
commit | 043c407a43bf6cff8a66d6bc60e3710fac9830ce (patch) | |
tree | 01f9d338b643c8f9d9f11b26934c1735d76a2553 | |
parent | 9b8941e813288a82712a56daef2003e88cc497f3 (diff) | |
download | msg-service-043c407a43bf6cff8a66d6bc60e3710fac9830ce.tar.gz msg-service-043c407a43bf6cff8a66d6bc60e3710fac9830ce.tar.bz2 msg-service-043c407a43bf6cff8a66d6bc60e3710fac9830ce.zip |
Address validation check.
-rwxr-xr-x | proxy/MsgHandleTransport.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/proxy/MsgHandleTransport.cpp b/proxy/MsgHandleTransport.cpp index 000f66d..daf73f6 100755 --- a/proxy/MsgHandleTransport.cpp +++ b/proxy/MsgHandleTransport.cpp @@ -24,6 +24,8 @@ #include "MsgHandle.h" +#define MAX_ADDRESS_LEN 21 // including '+' + /*================================================================================================== IMPLEMENTATION OF MsgHandle - Transport Member Functions ==================================================================================================*/ @@ -87,6 +89,17 @@ msg_error_t MsgHandle::submitReq(MSG_REQUEST_S* pReq) // Convert MSG_MESSAGE_S to MSG_MESSAGE_INFO_S convertMsgStruct(reqmsg, &(reqInfo.msgInfo)); + /* Check address validation */ + if (reqInfo.msgInfo.msgType.mainType == MSG_SMS_TYPE) { + for(int i=0; i<reqmsg->addr_list->nCount; i++) { + if (reqInfo.msgInfo.addressList[i].addressVal[0] == '+' && strlen(reqInfo.msgInfo.addressList[i].addressVal)>MAX_ADDRESS_LEN) { + return MSG_ERR_INVALID_PARAMETER; + } else if (strlen(reqInfo.msgInfo.addressList[i].addressVal)>(MAX_ADDRESS_LEN-1)) { + return MSG_ERR_INVALID_PARAMETER; + } + } + } + MSG_MESSAGE_TYPE_S msgType = {0,}; msgType.mainType = reqmsg->mainType; |