From 36db4b129dbf8635c9d2641ce2e9f66c9cab5426 Mon Sep 17 00:00:00 2001 From: Felipe Contreras Date: Tue, 10 Jun 2025 02:45:55 -0600 Subject: [PATCH] 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 --- xkb/xkb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xkb/xkb.c b/xkb/xkb.c index 60984c5a2..f291600a3 100644 --- a/xkb/xkb.c +++ b/xkb/xkb.c @@ -6545,7 +6545,7 @@ ProcXkbGetDeviceInfo(ClientPtr client) walk += sizeof(xkbActionWireDesc)*rep.nBtnsRtrn; } - length -= sz; + length -= walk - buf; if (nDeviceLedFBs > 0) { status = FillDeviceLedFBs(dev, ledClass, ledID, length, walk, client); @@ -6559,7 +6559,7 @@ ProcXkbGetDeviceInfo(ClientPtr client) return BadLength; } - WriteToClient(client, sizeof(buf), &buf); + WriteToClient(client, sz, buf); return Success; }