summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Danjou <julien@danjou.info>2009-10-20 18:10:12 +0200
committerJulien Danjou <julien@danjou.info>2009-10-20 18:10:12 +0200
commitd5b5d682465bd3196105df86d6df9fcde9518e6c (patch)
treefac8fbd76d3061d1835c18b854a78feed73d7efa
parentc52b719e906c05b1742a378a93ac3343a86f8f08 (diff)
icccm: fix reply->format check
We need to check reply->format before using it, or we can end up dividing by 0. Signed-off-by: Julien Danjou <julien@danjou.info>
-rw-r--r--icccm/icccm.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/icccm/icccm.c b/icccm/icccm.c
index 51132a9..18c2cf2 100644
--- a/icccm/icccm.c
+++ b/icccm/icccm.c
@@ -633,15 +633,13 @@ uint8_t
xcb_get_wm_hints_from_reply(xcb_wm_hints_t *hints,
xcb_get_property_reply_t *reply)
{
- if(!reply)
+ if(!reply || reply->type != WM_HINTS || reply->format != 32)
return 0;
int length = xcb_get_property_value_length(reply);
int num_elem = length / (reply->format / 8);
- if (reply->type != WM_HINTS
- || reply->format != 32
- || num_elem < XCB_NUM_WM_HINTS_ELEMENTS - 1)
+ if(num_elem < XCB_NUM_WM_HINTS_ELEMENTS - 1)
return 0;
memcpy(hints, (xcb_size_hints_t *) xcb_get_property_value(reply), length);