From a77de3094e9e29661efff00876b06f2f97e0bf3f Mon Sep 17 00:00:00 2001 From: Olivier Fourdan Date: Fri, 2 Oct 2026 15:42:42 +0200 Subject: [PATCH] XRes: prevent overflow in resource bytes swap path SProcXResQueryResourceBytes multiplied numSpecs by the spec size before REQUEST_FIXED_SIZE without an overflow check. On 32-bit servers, a large numSpecs can wrap, pass length validation, and walk the swap loop past the request buffer. Reject numSpecs values that would cause an overflow before validating or swapping the array, matching ProcXResQueryResourceBytes. CVE-2026-109094 Signed-off-by: Olivier Fourdan Assisted-by: AI Part-of: --- Xext/xres.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Xext/xres.c b/Xext/xres.c index fd1408ed47..66fecfde39 100644 --- a/Xext/xres.c +++ b/Xext/xres.c @@ -1086,6 +1086,8 @@ SProcXResQueryResourceBytes (ClientPtr client) REQUEST_AT_LEAST_SIZE(xXResQueryResourceBytesReq); swapl(&stuff->numSpecs); + if (stuff->numSpecs > UINT32_MAX / sizeof(specs[0])) + return BadLength; REQUEST_FIXED_SIZE(xXResQueryResourceBytesReq, stuff->numSpecs * sizeof(specs[0])); -- GitLab