make sure packet size is multiple of 16 bytes

This commit is contained in:
orignal 2015-03-18 13:30:38 -04:00
parent 47c3d5ed23
commit 647bb501d1

View File

@ -1094,6 +1094,8 @@ namespace transport
{ {
uint8_t buf[SSU_MTU_V4 + 18]; uint8_t buf[SSU_MTU_V4 + 18];
size_t msgSize = len + sizeof (SSUHeader); size_t msgSize = len + sizeof (SSUHeader);
size_t paddingSize = msgSize >> 4; // %16
if (paddingSize > 0) msgSize += (16 - paddingSize);
if (msgSize > SSU_MTU_V4) if (msgSize > SSU_MTU_V4)
{ {
LogPrint (eLogWarning, "SSU payload size ", msgSize, " exceeds MTU"); LogPrint (eLogWarning, "SSU payload size ", msgSize, " exceeds MTU");