Xi: ProcXIGetSelectedEvents needs to use unswapped length to send reply
CVE-2024-31080
Reported-by: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=69762
Fixes: 53e821ab4
("Xi: add request processing for XIGetSelectedEvents.")
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1463>
This commit is contained in:
parent
272e2915fe
commit
96798fc196
|
@ -349,6 +349,7 @@ ProcXIGetSelectedEvents(ClientPtr client)
|
||||||
InputClientsPtr others = NULL;
|
InputClientsPtr others = NULL;
|
||||||
xXIEventMask *evmask = NULL;
|
xXIEventMask *evmask = NULL;
|
||||||
DeviceIntPtr dev;
|
DeviceIntPtr dev;
|
||||||
|
uint32_t length;
|
||||||
|
|
||||||
REQUEST(xXIGetSelectedEventsReq);
|
REQUEST(xXIGetSelectedEventsReq);
|
||||||
REQUEST_SIZE_MATCH(xXIGetSelectedEventsReq);
|
REQUEST_SIZE_MATCH(xXIGetSelectedEventsReq);
|
||||||
|
@ -418,10 +419,12 @@ ProcXIGetSelectedEvents(ClientPtr client)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* save the value before SRepXIGetSelectedEvents swaps it */
|
||||||
|
length = reply.length;
|
||||||
WriteReplyToClient(client, sizeof(xXIGetSelectedEventsReply), &reply);
|
WriteReplyToClient(client, sizeof(xXIGetSelectedEventsReply), &reply);
|
||||||
|
|
||||||
if (reply.num_masks)
|
if (reply.num_masks)
|
||||||
WriteToClient(client, reply.length * 4, buffer);
|
WriteToClient(client, length * 4, buffer);
|
||||||
|
|
||||||
free(buffer);
|
free(buffer);
|
||||||
return Success;
|
return Success;
|
||||||
|
|
Loading…
Reference in New Issue