check tunnel payload size

This commit is contained in:
orignal 2016-01-25 14:31:51 -05:00
parent 30f68759ff
commit 8061d306dd
2 changed files with 10 additions and 0 deletions

View file

@ -90,6 +90,11 @@ namespace tunnel
msg->offset = fragment - msg->buf;
msg->len = msg->offset + size;
if (msg->len > msg->maxLen)
{
LogPrint (eLogError, "TunnelMessage: fragment is too long ", (int)size);
return;
}
if (fragment + size < decrypted + TUNNEL_DATA_ENCRYPTED_SIZE)
{
// this is not last message. we have to copy it