diff options
author | Ulrich Sibiller <uli42@gmx.de> | 2018-12-18 00:05:50 +0100 |
---|---|---|
committer | Ulrich Sibiller <uli42@gmx.de> | 2018-12-18 00:05:50 +0100 |
commit | 5b0bf752a0c5a224ddf42cccdcb37534357c08ab (patch) | |
tree | 7625d46d5183a1b47dcc200e8d15cd1588ba748f | |
parent | a4fad8f58e8c7f601f70801016861f970ab05827 (diff) | |
download | nx-libs-5b0bf752a0c5a224ddf42cccdcb37534357c08ab.tar.gz nx-libs-5b0bf752a0c5a224ddf42cccdcb37534357c08ab.tar.bz2 nx-libs-5b0bf752a0c5a224ddf42cccdcb37534357c08ab.zip |
xkb: Initialize pad bytes sent in replies of geometry requests.
Backport of
commit dc9ce695a69ca0787f58f8d160212a7a41acb703
Author: Rami Ylimäki <rami.ylimaki@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@vincit.fi>
Signed-off-by: Rami Ylimäki <rami.ylimaki@vincit.fi>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r-- | nx-X11/programs/Xserver/xkb/xkb.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/nx-X11/programs/Xserver/xkb/xkb.c b/nx-X11/programs/Xserver/xkb/xkb.c index 67d7f2b95..8d3fc6108 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; |