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; } }