From d5808df79fa41e608b7ac04c005fba08525a4e5d Mon Sep 17 00:00:00 2001 From: Kees Cook Date: Wed, 14 Apr 2010 21:19:48 -0700 Subject: [PATCH] Atoms from XIGetProperty are 32bits 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. Signed-off-by: Kees Cook --- src/property.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/property.c b/src/property.c index 6cd8e7a..9c6472a 100644 --- a/src/property.c +++ b/src/property.c @@ -115,10 +115,10 @@ print_property(Display *dpy, XDevice* dev, 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; } default: @@ -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; -- 1.7.0.4