[PATCH 2/4] xcb_ewmh_get_wm_icon_reply: Fix crash on error
Uli Schlachter
psychon at znc.in
Fri Mar 11 04:21:46 PST 2011
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 at znc.in>
---
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
--
1.7.4.1
--------------050606080800060709000007
Content-Type: text/x-diff;
name="0003-Return-more-icons-from-_NET_WM_ICON.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="0003-Return-more-icons-from-_NET_WM_ICON.patch"
More information about the Xcb
mailing list