diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2009-03-20 13:55:00 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2009-03-20 14:48:57 +1000 |
commit | f1c7b95d83948160a0d5796ef6c16fc0d1bf5c5d (patch) | |
tree | ccb37afe82b9c465b657e681ab101155b525f14a | |
parent | d60391d8ca9918d2089c23c0baef5c91177325f0 (diff) |
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>
-rw-r--r-- | dix/devices.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/dix/devices.c b/dix/devices.c index a79d04eb2..abe2c9e25 100644 --- a/dix/devices.c +++ b/dix/devices.c @@ -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; |