Description: CVE-2018-20022
 multiple weaknesses CWE-665: Improper Initialization vulnerability in VNC
 client code that allows attacker to read stack memory and can be abused for
 information disclosure. Combined with another vulnerability, it can be used
 to leak stack memory layout and in bypassing ASLR
Origin: https://github.com/LibVNC/libvncserver/commit/2f5b2ad1c6c99b1ac6482c95844a84d66bb52838
Bug: https://github.com/LibVNC/libvncserver/issues/252
Bug-Debian: https://bugs.debian.org/916941

[sunweaver] ported from libvncclient to tightvnc's vncviewer code

--- a/vncviewer/rfbproto.c
+++ b/vncviewer/rfbproto.c
@@ -886,6 +886,7 @@
 {
   rfbKeyEventMsg ke;
 
+  memset(&ke, 0, sizeof(ke));
   ke.type = rfbKeyEvent;
   ke.down = down ? 1 : 0;
   ke.key = Swap32IfLE(key);
@@ -906,6 +907,7 @@
     free(serverCutText);
   serverCutText = NULL;
 
+  memset(&cct, 0, sizeof(cct));
   cct.type = rfbClientCutText;
   cct.length = Swap32IfLE(len);
   return  (WriteExact(rfbsock, (char *)&cct, sz_rfbClientCutTextMsg) &&
