Commit aa5ca0e3 authored by Hubert Denkmair's avatar Hubert Denkmair

add size check

parent d70f5bbf
......@@ -25,6 +25,7 @@ bool TcpProtocol::Read(int socket)
while ((_bufTail - _bufHead)>=4)
{
size_t size = 4 + ntohl(*(reinterpret_cast<uint32_t*>(&_buf[_bufHead])));
if (size > _buf.size()) { return false; }
if (size <= (_bufTail - _bufHead))
{
OnMessageReceived(&_buf[_bufHead+4], size-4);
......
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