Fixed some package math.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4695 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
Cory McWilliams 2023-12-24 22:09:09 +00:00
parent adf8c14536
commit 9f2f9bd8b0

View File

@ -221,11 +221,13 @@ static void _http_add_body_bytes(tf_http_connection_t* connection, const void* d
p[mask_start + 2] << 16 |
p[mask_start + 3] << 24;
size_t i = 0;
for (i = mask_start + 4; i < length; i += 4)
size_t start = mask_start + 4;
size_t end = mask_start + 4 + length;
for (i = start; i < end; i += 4)
{
*(uint32_t*)(p + i) ^= mask;
}
for (; i < length; i++)
for (; i < end; i++)
{
p[i] ^= ((mask >> (8 * (i % 4))) & 0xff);
}
@ -233,7 +235,7 @@ static void _http_add_body_bytes(tf_http_connection_t* connection, const void* d
{
tf_printf("MESSAGE %d [%.*s]\n", opcode, (int)length, p + mask_start + 4);
}
size_t total_length + mask_Start + 4 + length;
size_t total_length = end;
memmove(connection->body, (char*)connection->body + total_length, connection->body_length - total_length);
connection->body_length -= total_length;
}