]> diplodocus.org Git - xorg-xinput/commitdiff
Atoms from XIGetProperty are 32bits (#27657)
authorKees Cook <kees.cook@canonical.com>
Thu, 15 Apr 2010 04:19:48 +0000 (21:19 -0700)
committerPeter Hutterer <peter.hutterer@who-t.net>
Tue, 18 May 2010 00:29:14 +0000 (10:29 +1000)
A 32bit value must be dereferenced to correctly zero-extend an Atom
from XIGetProperty.  On 64bit systems, Atom is 64bits, so the final
Atom in a list will read garbage in the upper half of the Atom.

X.Org Bug 27657 <http://bugs.freedesktop.org/show_bug.cgi?id=27657>

Signed-off-by: Kees Cook <kees.cook@canonical.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
src/property.c

index 6cd8e7af19a2da0e036be4c652784c3993fb552b..f8b21c7f4ced650fcd89307033cb3ed1476a9601 100644 (file)
@@ -461,10 +461,10 @@ print_property_xi2(Display *dpy, int deviceid, Atom property)
                     break;
                 case XA_ATOM:
                     {
-                        Atom a = *(Atom*)ptr;
-                        printf("\"%s\" (%d)",
+                        Atom a = *(uint32_t*)ptr;
+                        printf("\"%s\" (%ld)",
                                 (a) ? XGetAtomName(dpy, a) : "None",
-                                (int)a);
+                                a);
                         break;
                     }
                     break;