diff options
author | Uli Schlachter <psychon@znc.in> | 2011-03-11 13:21:46 +0100 |
---|---|---|
committer | Arnaud Fontaine <arnau@debian.org> | 2011-03-26 13:56:18 +0900 |
commit | c8a36b8591fe50b5fcea31d6bd5d469f8ac1c125 (patch) | |
tree | 3f8916f157d3d732be6cd082f69fa5786f1101bf /ewmh | |
parent | 4e5a8e47389ac54b1bae9e694d5a812388a0a380 (diff) |
xcb_ewmh_get_wm_icon_reply: Fix crash on error
When the GetProperty request fails due to an error,
xcb_ewmh_get_wm_icon_from_reply will be called with a NULL pointer for the
reply. This function would then call xcb_get_property_value_length on this NULL
pointer which caused a crash.
Fix this by moving the NULL-pointer check before the call to value_length().
Signed-off-by: Uli Schlachter <psychon@znc.in>
Reviewed-by: Arnaud Fontaine <arnau@debian.org>
Diffstat (limited to 'ewmh')
-rw-r--r-- | ewmh/ewmh.c.m4 | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/ewmh/ewmh.c.m4 b/ewmh/ewmh.c.m4 index 176ba19..490727e 100644 --- a/ewmh/ewmh.c.m4 +++ b/ewmh/ewmh.c.m4 @@ -1144,13 +1144,11 @@ uint8_t xcb_ewmh_get_wm_icon_from_reply(xcb_ewmh_get_wm_icon_reply_t *wm_icon, xcb_get_property_reply_t *r) { - const uint32_t r_value_len = xcb_get_property_value_length(r); - if(!r || r->type != XCB_ATOM_CARDINAL || r->format != 32 || - r_value_len <= (sizeof(uint32_t) * 2)) + if(!r || r->type != XCB_ATOM_CARDINAL || r->format != 32) return 0; - + uint32_t r_value_len = xcb_get_property_value_length(r); uint32_t *r_value = (uint32_t *) xcb_get_property_value(r); - if(!r_value) + if(r_value_len <= (sizeof(uint32_t) * 2) || !r_value) return 0; /* Check that the property is as long as it should be, handling |