dix: Guard against non-existing PtrFeedbackPtr

Trying to change the pointer control settings on a device without
PtrFeedbackPtr would be a bug and a crash in the Xserver.

Guard against that case by returning early with a BadImplementation
error, that might kill the X11 client but the Xserver would survive.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Related: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1137
(cherry picked from commit dee2bb033e)
This commit is contained in:
Olivier Fourdan 2021-02-15 11:33:56 +01:00 committed by Olivier Fourdan
parent d41b43345c
commit 6272529339
1 changed files with 3 additions and 0 deletions

View File

@ -2261,6 +2261,9 @@ ProcChangePointerControl(ClientPtr client)
REQUEST(xChangePointerControlReq);
REQUEST_SIZE_MATCH(xChangePointerControlReq);
/* If the device has no PtrFeedbackPtr, the xserver has a bug */
BUG_RETURN_VAL (!mouse->ptrfeed, BadImplementation);
ctrl = mouse->ptrfeed->ctrl;
if ((stuff->doAccel != xTrue) && (stuff->doAccel != xFalse)) {
client->errorValue = stuff->doAccel;