Commit 3f8c5797 by guanghui.cui

增加接收message长度判断

parent 62ab5cfd
......@@ -219,6 +219,11 @@ bool TCPClient::receive(std::string &message)
}
//然后读取数据部分
unsigned int lenHost = ntohl(buf.msgLen);
if (lenHost > FM_BUF_SIZE) {
//如果数据长度大于最大可接收范围,返回false
LOG(INFO) << "Out of maximum range,message length:" << lenHost;
return false;
}
readBytes = readn(m_sockfd, buf.text, lenHost);
if (readBytes == (size_t)-1)
{
......
......@@ -18,7 +18,7 @@
INITIALIZE_EASYLOGGINGPP
#define VERSION "1.0.5" //版本号
#define VERSION "1.0.4.1" //版本号
std::string g_init_data;
std::string g_init_data_ods_back;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment