Fix decoding of encoding message

tight-png
Andri Yngvason 2019-10-08 18:12:57 +00:00
parent e9f200f4cc
commit b54bc178f0
1 changed files with 6 additions and 3 deletions

View File

@ -524,8 +524,10 @@ static int on_client_set_encodings(struct nvnc_client *client)
int n_encodings = MIN(MAX_ENCODINGS, ntohs(msg->n_encodings));
int n = 0;
for (int i = 0; i < n_encodings; ++i)
switch (msg->encodings[i]) {
for (int i = 0; i < n_encodings; ++i) {
enum rfb_encodings encoding = htonl(msg->encodings[i]);
switch (encoding) {
case RFB_ENCODING_RAW:
case RFB_ENCODING_COPYRECT:
case RFB_ENCODING_RRE:
@ -534,8 +536,9 @@ static int on_client_set_encodings(struct nvnc_client *client)
case RFB_ENCODING_ZRLE:
case RFB_ENCODING_CURSOR:
case RFB_ENCODING_DESKTOPSIZE:
client->encodings[n++] = msg->encodings[i];
client->encodings[n++] = encoding;
}
}
client->n_encodings = n;