Use correct swap{l,s} (or none at all for CARD8)
Swapping the wrong size was never caught because swap{l,s} are macros. It's clear in the case of Xext/xres.c, that the author believed client_major/minor to be CARD16 from looking at the code in the first hunk. v2: dmx.c fixes from Keith. Reviewed-by: Peter Harris <pharris@opentext.com> Signed-off-by: Matt Turner <mattst88@gmail.com>
This commit is contained in:
parent
2c7c520cfe
commit
9edcae78c4
|
@ -1443,7 +1443,6 @@ SProcScreenSaverSuspend (ClientPtr client)
|
||||||
|
|
||||||
swaps(&stuff->length);
|
swaps(&stuff->length);
|
||||||
REQUEST_SIZE_MATCH(xScreenSaverSuspendReq);
|
REQUEST_SIZE_MATCH(xScreenSaverSuspendReq);
|
||||||
swapl(&stuff->suspend);
|
|
||||||
return ProcScreenSaverSuspend (client);
|
return ProcScreenSaverSuspend (client);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
12
Xext/xres.c
12
Xext/xres.c
|
@ -28,15 +28,9 @@ ProcXResQueryVersion (ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xXResQueryVersionReq);
|
REQUEST(xXResQueryVersionReq);
|
||||||
xXResQueryVersionReply rep;
|
xXResQueryVersionReply rep;
|
||||||
CARD16 client_major, client_minor; /* not used */
|
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH (xXResQueryVersionReq);
|
REQUEST_SIZE_MATCH (xXResQueryVersionReq);
|
||||||
|
|
||||||
client_major = stuff->client_major;
|
|
||||||
client_minor = stuff->client_minor;
|
|
||||||
(void) client_major;
|
|
||||||
(void) client_minor;
|
|
||||||
|
|
||||||
rep.type = X_Reply;
|
rep.type = X_Reply;
|
||||||
rep.length = 0;
|
rep.length = 0;
|
||||||
rep.sequenceNumber = client->sequence;
|
rep.sequenceNumber = client->sequence;
|
||||||
|
@ -316,8 +310,6 @@ SProcXResQueryVersion (ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xXResQueryVersionReq);
|
REQUEST(xXResQueryVersionReq);
|
||||||
REQUEST_SIZE_MATCH (xXResQueryVersionReq);
|
REQUEST_SIZE_MATCH (xXResQueryVersionReq);
|
||||||
swaps(&stuff->client_major);
|
|
||||||
swaps(&stuff->client_minor);
|
|
||||||
return ProcXResQueryVersion(client);
|
return ProcXResQueryVersion(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -326,7 +318,7 @@ SProcXResQueryClientResources (ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xXResQueryClientResourcesReq);
|
REQUEST(xXResQueryClientResourcesReq);
|
||||||
REQUEST_SIZE_MATCH (xXResQueryClientResourcesReq);
|
REQUEST_SIZE_MATCH (xXResQueryClientResourcesReq);
|
||||||
swaps(&stuff->xid);
|
swapl(&stuff->xid);
|
||||||
return ProcXResQueryClientResources(client);
|
return ProcXResQueryClientResources(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -335,7 +327,7 @@ SProcXResQueryClientPixmapBytes (ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xXResQueryClientPixmapBytesReq);
|
REQUEST(xXResQueryClientPixmapBytesReq);
|
||||||
REQUEST_SIZE_MATCH (xXResQueryClientPixmapBytesReq);
|
REQUEST_SIZE_MATCH (xXResQueryClientPixmapBytesReq);
|
||||||
swaps(&stuff->xid);
|
swapl(&stuff->xid);
|
||||||
return ProcXResQueryClientPixmapBytes(client);
|
return ProcXResQueryClientPixmapBytes(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -127,7 +127,6 @@ static void CopySwapDeviceCore (ClientPtr client, DeviceIntPtr dev, char *buf)
|
||||||
if (client->swapped) {
|
if (client->swapped) {
|
||||||
swaps(&c->control);
|
swaps(&c->control);
|
||||||
swaps(&c->length);
|
swaps(&c->length);
|
||||||
swaps(&c->status);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,7 +141,6 @@ static void CopySwapDeviceEnable (ClientPtr client, DeviceIntPtr dev, char *buf)
|
||||||
if (client->swapped) {
|
if (client->swapped) {
|
||||||
swaps(&e->control);
|
swaps(&e->control);
|
||||||
swaps(&e->length);
|
swaps(&e->length);
|
||||||
swaps(&e->enable);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -434,7 +434,7 @@ ProcXIChangeHierarchy(ClientPtr client)
|
||||||
any = (xXIAnyHierarchyChangeInfo*)&stuff[1];
|
any = (xXIAnyHierarchyChangeInfo*)&stuff[1];
|
||||||
while(stuff->num_changes--)
|
while(stuff->num_changes--)
|
||||||
{
|
{
|
||||||
SWAPIF(swapl(&any->type));
|
SWAPIF(swaps(&any->type));
|
||||||
SWAPIF(swaps(&any->length));
|
SWAPIF(swaps(&any->length));
|
||||||
|
|
||||||
required_len += any->length;
|
required_len += any->length;
|
||||||
|
|
|
@ -281,7 +281,7 @@ SwapButtonInfo(DeviceIntPtr dev, xXIButtonInfo* info)
|
||||||
swaps(&info->sourceid);
|
swaps(&info->sourceid);
|
||||||
|
|
||||||
for (i = 0, btn = (Atom*)&info[1]; i < info->num_buttons; i++, btn++)
|
for (i = 0, btn = (Atom*)&info[1]; i < info->num_buttons; i++, btn++)
|
||||||
swaps(btn);
|
swapl(btn);
|
||||||
|
|
||||||
swaps(&info->num_buttons);
|
swaps(&info->num_buttons);
|
||||||
}
|
}
|
||||||
|
|
10
hw/dmx/dmx.c
10
hw/dmx/dmx.c
|
@ -653,10 +653,10 @@ static int ProcDMXGetDesktopAttributes(ClientPtr client)
|
||||||
if (client->swapped) {
|
if (client->swapped) {
|
||||||
swaps(&rep.sequenceNumber);
|
swaps(&rep.sequenceNumber);
|
||||||
swapl(&rep.length);
|
swapl(&rep.length);
|
||||||
swapl(&rep.width);
|
swaps(&rep.width);
|
||||||
swapl(&rep.height);
|
swaps(&rep.height);
|
||||||
swapl(&rep.shiftX);
|
swaps(&rep.shiftX);
|
||||||
swapl(&rep.shiftY);
|
swaps(&rep.shiftY);
|
||||||
}
|
}
|
||||||
WriteToClient(client, sizeof(xDMXGetDesktopAttributesReply), (char *)&rep);
|
WriteToClient(client, sizeof(xDMXGetDesktopAttributesReply), (char *)&rep);
|
||||||
return Success;
|
return Success;
|
||||||
|
@ -891,7 +891,7 @@ static int SProcDMXForceWindowCreation(ClientPtr client)
|
||||||
|
|
||||||
swaps(&stuff->length);
|
swaps(&stuff->length);
|
||||||
REQUEST_SIZE_MATCH(xDMXForceWindowCreationReq);
|
REQUEST_SIZE_MATCH(xDMXForceWindowCreationReq);
|
||||||
swaps(&stuff->window);
|
swapl(&stuff->window);
|
||||||
return ProcDMXForceWindowCreation(client);
|
return ProcDMXForceWindowCreation(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -464,7 +464,7 @@ ProcXF86VidModeGetAllModeLines(ClientPtr client)
|
||||||
swaps(&mdinf.hsyncstart);
|
swaps(&mdinf.hsyncstart);
|
||||||
swaps(&mdinf.hsyncend);
|
swaps(&mdinf.hsyncend);
|
||||||
swaps(&mdinf.htotal);
|
swaps(&mdinf.htotal);
|
||||||
swaps(&mdinf.hskew);
|
swapl(&mdinf.hskew);
|
||||||
swaps(&mdinf.vdisplay);
|
swaps(&mdinf.vdisplay);
|
||||||
swaps(&mdinf.vsyncstart);
|
swaps(&mdinf.vsyncstart);
|
||||||
swaps(&mdinf.vsyncend);
|
swaps(&mdinf.vsyncend);
|
||||||
|
@ -1846,7 +1846,7 @@ SProcXF86VidModeSwitchToMode(ClientPtr client)
|
||||||
REQUEST(xXF86VidModeSwitchToModeReq);
|
REQUEST(xXF86VidModeSwitchToModeReq);
|
||||||
swaps(&stuff->length);
|
swaps(&stuff->length);
|
||||||
REQUEST_SIZE_MATCH(xXF86VidModeSwitchToModeReq);
|
REQUEST_SIZE_MATCH(xXF86VidModeSwitchToModeReq);
|
||||||
swaps(&stuff->screen);
|
swapl(&stuff->screen);
|
||||||
return ProcXF86VidModeSwitchToMode(client);
|
return ProcXF86VidModeSwitchToMode(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1117,7 +1117,7 @@ ProcRRGetPanning (ClientPtr client)
|
||||||
if (client->swapped) {
|
if (client->swapped) {
|
||||||
swaps(&rep.sequenceNumber);
|
swaps(&rep.sequenceNumber);
|
||||||
swapl(&rep.length);
|
swapl(&rep.length);
|
||||||
swaps(&rep.timestamp);
|
swapl(&rep.timestamp);
|
||||||
swaps(&rep.left);
|
swaps(&rep.left);
|
||||||
swaps(&rep.top);
|
swaps(&rep.top);
|
||||||
swaps(&rep.width);
|
swaps(&rep.width);
|
||||||
|
@ -1197,7 +1197,7 @@ sendReply:
|
||||||
if (client->swapped) {
|
if (client->swapped) {
|
||||||
swaps(&rep.sequenceNumber);
|
swaps(&rep.sequenceNumber);
|
||||||
swapl(&rep.length);
|
swapl(&rep.length);
|
||||||
swaps(&rep.newTimestamp);
|
swapl(&rep.newTimestamp);
|
||||||
}
|
}
|
||||||
WriteToClient(client, sizeof(xRRSetPanningReply), (char *)&rep);
|
WriteToClient(client, sizeof(xRRSetPanningReply), (char *)&rep);
|
||||||
return Success;
|
return Success;
|
||||||
|
|
|
@ -6190,7 +6190,6 @@ char * str;
|
||||||
swaps(&rep.supported);
|
swaps(&rep.supported);
|
||||||
swaps(&rep.unsupported);
|
swaps(&rep.unsupported);
|
||||||
swaps(&rep.nDeviceLedFBs);
|
swaps(&rep.nDeviceLedFBs);
|
||||||
swapl(&rep.type);
|
|
||||||
}
|
}
|
||||||
WriteToClient(client,SIZEOF(xkbGetDeviceInfoReply), (char *)&rep);
|
WriteToClient(client,SIZEOF(xkbGetDeviceInfoReply), (char *)&rep);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue