dix: do percentage check before device check in ProcBell
This is just for correctness. The server should return BadValue for anything not in [-100, 100]. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
d60391d8ca
commit
f1c7b95d83
|
@ -1905,6 +1905,11 @@ ProcBell(ClientPtr client)
|
|||
REQUEST(xBellReq);
|
||||
REQUEST_SIZE_MATCH(xBellReq);
|
||||
|
||||
if (stuff->percent < -100 || stuff->percent > 100) {
|
||||
client->errorValue = stuff->percent;
|
||||
return BadValue;
|
||||
}
|
||||
|
||||
/* Seems like no keyboard actually has the BellProc set. Returning
|
||||
* BadDevice (previous code) will make apps crash badly. The man pages
|
||||
* doesn't say anything about a BadDevice being returned either.
|
||||
|
@ -1913,11 +1918,6 @@ ProcBell(ClientPtr client)
|
|||
if (!keybd->kbdfeed->BellProc)
|
||||
return Success;
|
||||
|
||||
if (stuff->percent < -100 || stuff->percent > 100) {
|
||||
client->errorValue = stuff->percent;
|
||||
return BadValue;
|
||||
}
|
||||
|
||||
newpercent = (base * stuff->percent) / 100;
|
||||
if (stuff->percent < 0)
|
||||
newpercent = base + newpercent;
|
||||
|
|
Loading…
Reference in New Issue
Block a user