[X2Go-Commits] [nx-libs] 02/51: xkb: Initialize pad bytes sent in replies of geometry requests.

git-admin at x2go.org git-admin at x2go.org
Fri Feb 8 05:40:00 CET 2019


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository nx-libs.

commit 5b0bf752a0c5a224ddf42cccdcb37534357c08ab
Author: Ulrich Sibiller <uli42 at gmx.de>
Date:   Tue Dec 18 00:05:50 2018 +0100

    xkb: Initialize pad bytes sent in replies of geometry requests.
    
    Backport of
    
      commit dc9ce695a69ca0787f58f8d160212a7a41acb703
      Author: Rami Ylimäki <rami.ylimaki at vincit.fi>
      Date:   Wed Mar 9 15:45:40 2011 +0200
    
        xkb: Initialize pad bytes sent in replies of geometry requests.
    
        Valgrind complains about uninitialized data being written to clients.
    
        Reviewed-by: Erkki Seppälä <erkki.seppala at vincit.fi>
        Signed-off-by: Rami Ylimäki <rami.ylimaki at vincit.fi>
        Reviewed-by: Daniel Stone <daniel at fooishbar.org>
        Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
        Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 nx-X11/programs/Xserver/xkb/xkb.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/nx-X11/programs/Xserver/xkb/xkb.c b/nx-X11/programs/Xserver/xkb/xkb.c
index 67d7f2b..8d3fc61 100644
--- a/nx-X11/programs/Xserver/xkb/xkb.c
+++ b/nx-X11/programs/Xserver/xkb/xkb.c
@@ -3783,7 +3783,7 @@ ProcXkbSetNames(ClientPtr client)
 static char *
 XkbWriteCountedString(char *wire,char *str,Bool swap)
 {
-CARD16	len,*pLen;
+CARD16	len,*pLen, paddedLen;
 
     len= (str?strlen(str):0);
     pLen= (CARD16 *)wire;
@@ -3791,8 +3791,9 @@ CARD16	len,*pLen;
     if (swap) {
 	swaps(pLen);
     }
-    memcpy(&wire[2],str,len);
-    wire+= ((2+len+3)/4)*4;
+    paddedLen= pad_to_int32(sizeof(len)+len)-sizeof(len);
+    strncpy(&wire[sizeof(len)],str,paddedLen);
+    wire+= sizeof(len)+paddedLen;
     return wire;
 }
 
@@ -3903,6 +3904,7 @@ xkbShapeWireDesc *	shapeWire;
 	if (shape->approx!=NULL)
 	     shapeWire->approxNdx= XkbOutlineIndex(shape,shape->approx);
 	else shapeWire->approxNdx= XkbNoShape;
+	shapeWire->pad= 0;
 	if (swap) {
 	    swapl(&shapeWire->name);
 	}
@@ -3914,6 +3916,7 @@ xkbShapeWireDesc *	shapeWire;
 	    olWire= (xkbOutlineWireDesc *)wire;
 	    olWire->nPoints= ol->num_points;
 	    olWire->cornerRadius= ol->corner_radius;
+	    olWire->pad= 0;
 	    wire= (char *)&olWire[1];
 	    ptWire= (xkbPointWireDesc *)wire;
 	    for (p=0,pt=ol->points;p<ol->num_points;p++,pt++) {
@@ -4023,6 +4026,8 @@ xkbOverlayWireDesc *	olWire;
    olWire= (xkbOverlayWireDesc *)wire;
    olWire->name= ol->name;
    olWire->nRows= ol->num_rows;
+   olWire->pad1= 0;
+   olWire->pad2= 0;
    if (swap) {
 	swapl(&olWire->name);
    }
@@ -4034,6 +4039,7 @@ xkbOverlayWireDesc *	olWire;
 	rowWire= (xkbOverlayRowWireDesc *)wire;
 	rowWire->rowUnder= row->row_under;
 	rowWire->nKeys= row->num_keys;
+	rowWire->pad1= 0;
 	wire= (char *)&rowWire[1];
 	for (k=0,key=row->keys;k<row->num_keys;k++,key++) {
 	    xkbOverlayKeyWireDesc *	keyWire;

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/nx-libs.git


More information about the x2go-commits mailing list