diff --git a/src/protocols/vnc/cursor.c b/src/protocols/vnc/cursor.c index 22d45ebe4..17800c330 100644 --- a/src/protocols/vnc/cursor.c +++ b/src/protocols/vnc/cursor.c @@ -99,9 +99,9 @@ void guac_vnc_cursor(rfbClient* client, int x, int y, int w, int h, int bpp) { else alpha = 0x00; /* Translate value to RGB */ - red = (v >> client->format.redShift) * 0x100 / (client->format.redMax + 1); - green = (v >> client->format.greenShift) * 0x100 / (client->format.greenMax+ 1); - blue = (v >> client->format.blueShift) * 0x100 / (client->format.blueMax + 1); + red = ((v >> client->format.redShift) & client->format.redMax) * 0xFF / client->format.redMax; + green = ((v >> client->format.greenShift) & client->format.greenMax)* 0xFF / client->format.greenMax; + blue = ((v >> client->format.blueShift) & client->format.blueMax) * 0xFF / client->format.blueMax; /* Output ARGB */ if (vnc_client->settings->swap_red_blue) diff --git a/src/protocols/vnc/display.c b/src/protocols/vnc/display.c index 7273e4b31..3a17e870d 100644 --- a/src/protocols/vnc/display.c +++ b/src/protocols/vnc/display.c @@ -109,9 +109,9 @@ void guac_vnc_update(rfbClient* client, int x, int y, int w, int h) { } /* Translate value to RGB */ - red = (v >> client->format.redShift) * 0x100 / (client->format.redMax + 1); - green = (v >> client->format.greenShift) * 0x100 / (client->format.greenMax+ 1); - blue = (v >> client->format.blueShift) * 0x100 / (client->format.blueMax + 1); + red = ((v >> client->format.redShift) & client->format.redMax) * 0xFF / client->format.redMax; + green = ((v >> client->format.greenShift) & client->format.greenMax)* 0xFF / client->format.greenMax; + blue = ((v >> client->format.blueShift) & client->format.blueMax) * 0xFF / client->format.blueMax; /* Output RGB */ if (vnc_client->settings->swap_red_blue)