check for 16 bytes boundary before encryption

This commit is contained in:
orignal 2014-04-18 14:38:32 -04:00
parent 4cbc7773ac
commit 607f2d29f2
2 changed files with 5 additions and 4 deletions

View file

@ -483,7 +483,7 @@ namespace ntcp
*((uint16_t *)sendBuffer) = 0;
*((uint32_t *)(sendBuffer + 2)) = htobe32 (time (0));
}
int rem = (len + 6) % 16;
int rem = (len + 6) & 0x0F; // %16
int padding = 0;
if (rem > 0) padding = 16 - rem;
// TODO: fill padding