xkb: fix regression in GetDeviceInfo

This fixes a regression in 5499a2999 (xkb: let SendDeviceLedFBs() fill buffer instead of writing directly, 2024-07-16).

We need to write the whole buffer, and the updated length has to take
into consideration that `sz` now contains `led_len` so we need to
subtract that or properly calculate the remaining size.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
This commit is contained in:
Felipe Contreras 2025-06-10 02:45:55 -06:00 committed by Enrico Weigelt, metux IT consult
parent 9f936bced3
commit 36db4b129d

View File

@ -6545,7 +6545,7 @@ ProcXkbGetDeviceInfo(ClientPtr client)
walk += sizeof(xkbActionWireDesc)*rep.nBtnsRtrn; walk += sizeof(xkbActionWireDesc)*rep.nBtnsRtrn;
} }
length -= sz; length -= walk - buf;
if (nDeviceLedFBs > 0) { if (nDeviceLedFBs > 0) {
status = FillDeviceLedFBs(dev, ledClass, ledID, length, walk, client); status = FillDeviceLedFBs(dev, ledClass, ledID, length, walk, client);
@ -6559,7 +6559,7 @@ ProcXkbGetDeviceInfo(ClientPtr client)
return BadLength; return BadLength;
} }
WriteToClient(client, sizeof(buf), &buf); WriteToClient(client, sz, buf);
return Success; return Success;
} }