From d5b5d682465bd3196105df86d6df9fcde9518e6c Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Tue, 20 Oct 2009 18:10:12 +0200 Subject: 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 --- icccm/icccm.c | 6 ++---- 1 file 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); -- cgit v1.2.3