summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2009-06-07 19:26:45 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2009-06-07 20:35:14 +1000
commit9390b7a133b0e17bc4d303effb7a99ff7017b086 (patch)
tree46a098faaa71796a28ac5cb57d597fd2768d648c
parent21ee53060b4dcb5c12074cf6682ff0067021ff60 (diff)
dix: protect against missing ButtonClasses in GetPointerMapping.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--dix/devices.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/dix/devices.c b/dix/devices.c
index eb54e0aff..3996ca64a 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -1724,10 +1724,11 @@ ProcGetPointerMapping(ClientPtr client)
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
- rep.nElts = butc->numButtons;
+ rep.nElts = (butc) ? butc->numButtons : 0;
rep.length = ((unsigned)rep.nElts + (4-1))/4;
WriteReplyToClient(client, sizeof(xGetPointerMappingReply), &rep);
- (void)WriteToClient(client, (int)rep.nElts, (char *)&butc->map[1]);
+ if (butc)
+ WriteToClient(client, (int)rep.nElts, (char *)&butc->map[1]);
return Success;
}