From: Kees Cook Date: Thu, 15 Apr 2010 04:19:48 +0000 (-0700) Subject: Atoms from XIGetProperty are 32bits (#27657) X-Git-Url: https://diplodocus.org/git/xorg-xinput/commitdiff_plain/87ec8d42c7f8e4e0613bcbe59fb2db991e1e4acb?ds=sidebyside;hp=--cc Atoms from XIGetProperty are 32bits (#27657) 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 Signed-off-by: Kees Cook Signed-off-by: Peter Hutterer --- 87ec8d42c7f8e4e0613bcbe59fb2db991e1e4acb diff --git a/src/property.c b/src/property.c index 6cd8e7a..f8b21c7 100644 --- a/src/property.c +++ b/src/property.c @@ -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;