From e4cd5312f15b86b0398465bb575e9486c73c1250 Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Mon, 1 Jan 2024 22:22:03 +0000 Subject: [PATCH] Oops, fix websockets. git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4721 ed5197a5-7fde-0310-b194-c3ffbd925b24 --- src/http.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/http.c b/src/http.c index c04c5850..aafd5483 100644 --- a/src/http.c +++ b/src/http.c @@ -308,9 +308,12 @@ static void _http_add_body_bytes(tf_http_connection_t* connection, const void* d connection->fragment_length = 0; } connection->websocket_message_index++; - if (connection->body_length > total_length) + if (connection->body_length >= total_length) { - memmove(connection->body, (char*)connection->body + total_length, connection->body_length - total_length); + if (connection->body_length > total_length) + { + memmove(connection->body, (char*)connection->body + total_length, connection->body_length - total_length); + } connection->body_length -= total_length; } }