From 54557f062e15e13de2e351eae02ed54f28068102 Mon Sep 17 00:00:00 2001 From: Rui Matos Date: Mon, 5 Oct 2015 17:53:57 +0200 Subject: [PATCH] xprops: Fix reading Window and XSyncCounter properties Both Window and XSyncCounter are XIDs which on 64 bit X clients are 8 bytes wide. But the values on the wire are 32 bit so, for these types, we always copy 4 bytes into results->prop. As such copying them out with a cast such as *(Window *) means that we are actually reading 8 bytes which depending on whether the higher addressed 4 bytes are zero means that sometimes this works while others it gives us a bogus value. https://bugzilla.gnome.org/show_bug.cgi?id=756074 --- src/x11/xprops.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/x11/xprops.c b/src/x11/xprops.c index 589d53810..be3882455 100644 --- a/src/x11/xprops.c +++ b/src/x11/xprops.c @@ -507,7 +507,7 @@ window_from_results (GetPropertyResults *results, if (!validate_or_free_results (results, 32, XA_WINDOW, TRUE)) return FALSE; - *window_p = *(Window*) results->prop; + *window_p = *(uint32_t *) results->prop; g_free (results->prop); results->prop = NULL; @@ -523,7 +523,7 @@ counter_from_results (GetPropertyResults *results, TRUE)) return FALSE; - *counter_p = *(XSyncCounter*) results->prop; + *counter_p = *(uint32_t *) results->prop; g_free (results->prop); results->prop = NULL;