mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-06-07 06:28:19 +02:00
xkb: reject key types with num_levels exceeding XkbMaxShiftLevel
CheckKeyTypes validates incoming key type definitions from XkbSetMap
requests but does not enforce an upper bound on numLevels. A client can set
numLevels up to 255 on a non-canonical key type, which is stored in the
server's type table.
When ChangeKeyboardMapping later triggers XkbUpdateKeyTypesFromCore, the
function XkbKeyTypesForCoreSymbols computes groupsWidth from num_levels and
uses the XKB_OFFSET(g, l) = (g * groupsWidth) + l macro to index into
tsyms[], a stack-allocated buffer of XkbMaxSymsPerKey (252) entries. With
num_levels=255, groupsWidth=255, and indices reach up to 3*255+254 = 1019,
overflowing the 252-element stack buffer by 767 KeySym-sized entries.
Fix by rejecting numLevels values greater than XkbMaxShiftLevel (63) in
CheckKeyTypes, alongside the existing lower-bound check for numLevels < 1.
This vulnerability was discovered by:
Anonymous working with TrendAI Zero Day Initiative
ZDI-CAN-30160
Assisted-by: Claude:claude-opus-4-6
(cherry picked from commit 543e108516)
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2229>
This commit is contained in:
parent
92a167ab3f
commit
eced7e74ca
1 changed files with 1 additions and 1 deletions
|
|
@ -1648,7 +1648,7 @@ CheckKeyTypes(ClientPtr client,
|
|||
}
|
||||
n = i + req->firstType;
|
||||
width = wire->numLevels;
|
||||
if (width < 1) {
|
||||
if (width < 1 || width > XkbMaxShiftLevel) {
|
||||
*nMapsRtrn = _XkbErrCode3(0x04, n, width);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue