summaryrefslogtreecommitdiff
path: root/src/XIQueryDevice.c
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2009-06-16 14:20:30 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2009-06-16 14:22:18 +1000
commit099e6f77482e971103570cfd38092c3839f94927 (patch)
tree09e718f16b0439066140c0f09975390d9de2e48f /src/XIQueryDevice.c
parentbd2a3ad028a87f76ad244efe3650d7efd3a700dd (diff)
Protect button label copying against 64-bit Atom madness.
Datatype Atom is 8 bytes on 64 bit architectures, but it's always 4 bytes on the wire. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'src/XIQueryDevice.c')
-rw-r--r--src/XIQueryDevice.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/XIQueryDevice.c b/src/XIQueryDevice.c
index 9961655..e6a4d1b 100644
--- a/src/XIQueryDevice.c
+++ b/src/XIQueryDevice.c
@@ -107,8 +107,9 @@ copy_classes(XIDeviceInfo* to, xXIAnyInfo* from, int nclasses)
cls_lib->state.mask_len);
cls_lib->names = (Atom*)((char*)&cls_lib[1] + cls_lib->state.mask_len);
- memcpy(cls_lib->names, &cls_wire[1],
- cls_lib->num_buttons);
+ atoms =(uint32_t*)((char*)&cls_wire[1] + cls_lib->state.mask_len);
+ for (j = 0; j < cls_lib->num_buttons; j++)
+ cls_lib->names[j] = *atoms++;
ptr_lib += sizeof(XIButtonClassInfo);
ptr_lib += cls_lib->num_buttons * sizeof(Atom);