From 4148503d0cbd22b5ada11d6492a4b05aab1e18d0 Mon Sep 17 00:00:00 2001 From: Andri Yngvason Date: Wed, 24 Jan 2024 18:29:20 +0000 Subject: [PATCH] server: Allow server to request more than 32 encodings fixes #108 --- src/server.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/server.c b/src/server.c index 6381b4a..553885a 100644 --- a/src/server.c +++ b/src/server.c @@ -946,7 +946,7 @@ static int on_client_set_encodings(struct nvnc_client* client) (struct rfb_client_set_encodings_msg*)(client->msg_buffer + client->buffer_index); - size_t n_encodings = MIN(MAX_ENCODINGS, ntohs(msg->n_encodings)); + size_t n_encodings = ntohs(msg->n_encodings); size_t n = 0; if (client->buffer_len - client->buffer_index < @@ -955,7 +955,7 @@ static int on_client_set_encodings(struct nvnc_client* client) client->quality = 10; - for (size_t i = 0; i < n_encodings; ++i) { + for (size_t i = 0; i < n_encodings && n < MAX_ENCODINGS; ++i) { enum rfb_encodings encoding = htonl(msg->encodings[i]); switch (encoding) {