One misuse of CARD32 was missed back when someone fixed the 64-bit
issues (background: X has 8-bit, 16-bit, and "32-bit stored in a long"
data formats; on a 64-bit system, long is 64 bits). This was causing
minimized windows to be restored as shaded, and possibly occasional
crashes, when wmaker was restarted.

Also, throw in a safety check that 10 items really were returned before
trying to access them.
---
 src/window.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/window.c b/src/window.c
index 8518739..8863275 100644
--- a/src/window.c
+++ b/src/window.c
@@ -2338,12 +2338,12 @@ static int getSavedState(Window window, WSavedState ** 
state)
        int fmt_ret;
        unsigned long nitems_ret;
        unsigned long bytes_after_ret;
-       CARD32 *data;
+       long *data;
 
        if (XGetWindowProperty(dpy, window, _XA_WINDOWMAKER_STATE, 0, 10,
                               True, _XA_WINDOWMAKER_STATE,
                               &type_ret, &fmt_ret, &nitems_ret, 
&bytes_after_ret,
-                              (unsigned char **)&data) != Success || !data)
+                              (unsigned char **)&data) != Success || !data || 
nitems_ret < 10)
                return 0;
 
        *state = wmalloc(sizeof(WSavedState));
-- 
1.7.0.4


-- 
To unsubscribe, send mail to [email protected].

Reply via email to