From d30aee7722a6cd3a68dcd282c626b65e969f6520 Mon Sep 17 00:00:00 2001 From: Curtis McEnroe Date: Thu, 31 Oct 2019 18:01:05 -0400 Subject: Shrink client buffer size Clients are generally not going to send huge amounts at a time, and IRC messages are limited to 512 bytes. If in the future we supported message tags from clients, which have a size limit of 8191 bytes, this would unfortunately have to be set much higher. --- client.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'client.c') diff --git a/client.c b/client.c index a191f42..bcb281f 100644 --- a/client.c +++ b/client.c @@ -38,7 +38,7 @@ struct Client { enum Need need; size_t consumer; bool serverTime; - char buf[4096]; + char buf[1024]; size_t len; bool error; }; @@ -220,6 +220,7 @@ static bool intercept(const char *line, size_t len) { } void clientRecv(struct Client *client) { + assert(client->len < sizeof(client->buf)); ssize_t read = tls_read( client->tls, &client->buf[client->len], sizeof(client->buf) - client->len -- cgit 1.4.1