Description: CVE-2018-20021
 CWE-835: Infinite loop vulnerability in VNC client code. Vulnerability allows
 attacker to consume excessive amount of resources like CPU and RAM
Origin: https://github.com/LibVNC/libvncserver/commit/c3115350eb8bb635d0fdb4dbbb0d0541f38ed19c
Bug: https://github.com/LibVNC/libvncserver/issues/251
Bug-Debian: https://bugs.debian.org/916941

[sunweaver] port libvncclient patch over to tightvnc's vncviewer code

--- a/vncviewer/rfbproto.c
+++ b/vncviewer/rfbproto.c
@@ -1021,7 +1021,7 @@
 	bytesPerLine = rect.r.w * myFormat.bitsPerPixel / 8;
 	linesToRead = BUFFER_SIZE / bytesPerLine;
 
-	while (rect.r.h > 0) {
+	while (linesToRead && rect.r.h > 0) {
 	  if (linesToRead > rect.r.h)
 	    linesToRead = rect.r.h;
 
