diff options
author | Rami Ylimäki <rami.ylimaki@vincit.fi> | 2011-03-09 15:45:40 +0200 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2011-03-17 10:53:35 +1000 |
commit | dc9ce695a69ca0787f58f8d160212a7a41acb703 (patch) | |
tree | 1a1d14709fec6a63e4b72e5ca53e87ef1ca52538 /xkb | |
parent | ee3a4951a49312a2b68025db00c71472eb84293f (diff) |
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>
Diffstat (limited to 'xkb')
-rw-r--r-- | xkb/xkb.c | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -4321,7 +4321,7 @@ ProcXkbSetNames(ClientPtr client) static char * XkbWriteCountedString(char *wire,char *str,Bool swap) { - CARD16 len,*pLen; + CARD16 len,*pLen, paddedLen; if (!str) return wire; @@ -4333,8 +4333,9 @@ XkbWriteCountedString(char *wire,char *str,Bool swap) register int n; swaps(pLen,n); } - 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; } @@ -4445,6 +4446,7 @@ xkbShapeWireDesc * shapeWire; if (shape->approx!=NULL) shapeWire->approxNdx= XkbOutlineIndex(shape,shape->approx); else shapeWire->approxNdx= XkbNoShape; + shapeWire->pad= 0; if (swap) { register int n; swapl(&shapeWire->name,n); @@ -4457,6 +4459,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++) { @@ -4570,6 +4573,8 @@ xkbOverlayWireDesc * olWire; olWire= (xkbOverlayWireDesc *)wire; olWire->name= ol->name; olWire->nRows= ol->num_rows; + olWire->pad1= 0; + olWire->pad2= 0; if (swap) { register int n; swapl(&olWire->name,n); @@ -4582,6 +4587,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; |