mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-06-07 09:58:20 +02:00
xkb: Fix off-by-one in color index validation in _CheckSetGeom()
The bounds checks for baseColorNdx and labelColorNdx in _CheckSetGeom() use '>' instead of '>=' when comparing against req->nColors. Since nColors is a count and valid indices are 0 to nColors-1, an index equal to nColors is one past the end of the array. Assisted-by: Claude:claude-claude-opus-4-6 Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2208>
This commit is contained in:
parent
86a321ad98
commit
6b6e8020b9
1 changed files with 2 additions and 2 deletions
|
|
@ -5637,12 +5637,12 @@ _CheckSetGeom(XkbGeometryPtr geom, xkbSetGeometryReq * req, ClientPtr client)
|
|||
client->errorValue = _XkbErrCode3(0x01, 2, req->nColors);
|
||||
return BadValue;
|
||||
}
|
||||
if (req->baseColorNdx > req->nColors) {
|
||||
if (req->baseColorNdx >= req->nColors) {
|
||||
client->errorValue =
|
||||
_XkbErrCode3(0x03, req->nColors, req->baseColorNdx);
|
||||
return BadMatch;
|
||||
}
|
||||
if (req->labelColorNdx > req->nColors) {
|
||||
if (req->labelColorNdx >= req->nColors) {
|
||||
client->errorValue =
|
||||
_XkbErrCode3(0x03, req->nColors, req->labelColorNdx);
|
||||
return BadMatch;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue