diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2010-08-23 13:20:09 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2010-09-02 16:12:52 +1000 |
commit | ff055506f0cbb852bed17acb9f9bbf1d715a854e (patch) | |
tree | ab6e98bb3c197acba8dad0b89ac4b6f087bc6539 | |
parent | 7925e8945649d4af237e6c3c5593b895a461bd1e (diff) |
dix: fix crash when removing devices on a buttonless MD pointer (#29669)
If the master does not have a button class, recalculating the number of
buttons required for this master dereferences a NULL pointer. Guard against
this, if the master pointer doesn't have a button class, it doesn't need to
update it's number of buttons.
Reproducible:
Two devices on the same master, device NB with axes but no buttons, device
A+B with axes and button .
If NB was the last one to send an event through the master when A+B is
removed from the server, master->button is NULL and leads to the above
NULL-pointer dereference.
X.Org Bug 29669 <http://bugs.freedesktop.org/show_bug.cgi?id=29669>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
-rw-r--r-- | dix/devices.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/dix/devices.c b/dix/devices.c index 62ff4b04c..f5d295295 100644 --- a/dix/devices.c +++ b/dix/devices.c @@ -2341,7 +2341,7 @@ RecalculateMasterButtons(DeviceIntPtr slave) maxbuttons = max(maxbuttons, dev->button->numButtons); } - if (master->button->numButtons != maxbuttons) + if (master->button && master->button->numButtons != maxbuttons) { int i; DeviceChangedEvent event; |