I think I imagined this message size limit.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3831 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
Cory McWilliams 2022-02-08 02:07:23 +00:00
parent 9a75af8146
commit 07b4f2b08f

View File

@ -58,7 +58,7 @@ typedef enum {
enum { enum {
k_connections_changed_callbacks_max = 8, k_connections_changed_callbacks_max = 8,
k_tf_ssb_rpc_message_body_length_max = 8192, k_tf_ssb_rpc_message_body_length_max = 65536,
}; };
typedef struct _tf_ssb_broadcast_t tf_ssb_broadcast_t; typedef struct _tf_ssb_broadcast_t tf_ssb_broadcast_t;
@ -1127,13 +1127,6 @@ static bool _tf_ssb_connection_box_stream_recv(tf_ssb_connection_t* connection)
} }
_tf_ssb_nonce_inc(connection->nonce); _tf_ssb_nonce_inc(connection->nonce);
connection->body_len = htons(*(uint16_t*)header); connection->body_len = htons(*(uint16_t*)header);
if (connection->body_len > k_tf_ssb_rpc_message_body_length_max)
{
char reason[512];
snprintf(reason, sizeof(reason), "body length is too large: %d", connection->body_len);
_tf_ssb_connection_close(connection, reason);
return false;
}
memcpy(connection->body_auth_tag, header + sizeof(uint16_t), sizeof(connection->body_auth_tag)); memcpy(connection->body_auth_tag, header + sizeof(uint16_t), sizeof(connection->body_auth_tag));
if (!connection->body_len) if (!connection->body_len)
{ {