Slight memcpy paranoia.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4713 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
Cory McWilliams 2023-12-30 21:41:48 +00:00
parent c1890775dc
commit 9d1476a760

View File

@ -229,10 +229,13 @@ static void _http_websocket_mask_in_place(uint8_t* p, uint32_t mask, size_t size
static void _http_add_body_bytes(tf_http_connection_t* connection, const void* data, size_t size) static void _http_add_body_bytes(tf_http_connection_t* connection, const void* data, size_t size)
{ {
if (connection->is_websocket) if (connection->is_websocket)
{
if (size)
{ {
connection->body = tf_realloc(connection->body, connection->body_length + size); connection->body = tf_realloc(connection->body, connection->body_length + size);
memcpy((char*)connection->body + connection->body_length, data, size); memcpy((char*)connection->body + connection->body_length, data, size);
connection->body_length += size; connection->body_length += size;
}
while (connection->body_length >= 2) while (connection->body_length >= 2)
{ {