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>
This commit is contained in:
parent
ee3a4951a4
commit
dc9ce695a6
12
xkb/xkb.c
12
xkb/xkb.c
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue
Block a user