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
This commit is contained in:
Rui Matos 2015-10-05 17:53:57 +02:00
parent 130807a308
commit 54557f062e

View File

@ -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;