Commit dc9ce695 authored by Rami Ylimäki's avatar Rami Ylimäki Committed by Peter Hutterer

xkb: Initialize pad bytes sent in replies of geometry requests.

Valgrind complains about uninitialized data being written to clients.
Reviewed-by: 's avatarErkki Seppälä <erkki.seppala@vincit.fi>
Signed-off-by: 's avatarRami Ylimäki <rami.ylimaki@vincit.fi>
Reviewed-by: 's avatarDaniel Stone <daniel@fooishbar.org>
Reviewed-by: 's avatarPeter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: 's avatarPeter Hutterer <peter.hutterer@who-t.net>
parent ee3a4951
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment