Xext/xres: fix wrong swap check

The byte-swap check for rep.spec.client used 'client->swapped'
(the queried client) instead of 'sendClient->swapped' (the
requesting client). The reply is sent to sendClient, so swapping
must be based on sendClient's byte order. When a byte-swapped
client queries a native-byte-order client (or vice versa), the
spec.client field in the reply has the wrong byte order, causing
the client library to misinterpret the XID. Lines 504 and later
correctly use sendClient->swapped, so this was an oversight.

Co-Authored-by: Claude Code <noreply@anthropic.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2181>
This commit is contained in:
Peter Hutterer 2026-04-17 12:03:59 +10:00 committed by Marge Bot
parent f7b5749315
commit d2d4fb35e7

View file

@ -462,7 +462,7 @@ ConstructClientIdValue(ClientPtr sendClient, ClientPtr client, CARD32 mask,
xXResClientIdValue rep;
rep.spec.client = client->clientAsMask;
if (client->swapped) {
if (sendClient->swapped) {
swapl (&rep.spec.client);
}