mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-06-07 06:28:19 +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
(cherry picked from commit 6b6e8020b9)
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2224>
This commit is contained in:
parent
39befa04f9
commit
7ee87732a9
1 changed files with 2 additions and 2 deletions
|
|
@ -5628,12 +5628,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