diff options
author | Erkki Seppälä <erkki.seppala@vincit.fi> | 2015-01-04 12:51:10 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2015-01-05 09:42:39 -0800 |
commit | aa02eb3d4f0c5722b8f9012ec08512daa7420184 (patch) | |
tree | 60a08c840b60c1c220c7fc54a01a8d8e37431452 | |
parent | 88135312d0cdfd624dfdd029539959849302a1f4 (diff) |
_XcmsGetProperty: don't deal with uninitialized values, fail instead
Import commit 502d414118c97d35a44f8e295709682022876331 from the
master copy of this code in libX11.
Signed-off-by: Erkki Seppälä <erkki.seppala@vincit.fi>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r-- | xcmsdb.c | 19 |
1 files changed, 11 insertions, 8 deletions
@@ -855,20 +855,23 @@ _XcmsGetProperty(Display *pDpy, Window w, Atom property, int *pFormat, long len = 6516; unsigned long nitems_ret, after_ret; Atom atom_ret; - - while (XGetWindowProperty (pDpy, w, property, 0, len, False, - XA_INTEGER, &atom_ret, &format_ret, - &nitems_ret, &after_ret, - (unsigned char **)&prop_ret)) { - if (after_ret > 0) { + int xgwp_ret; + + while (True) { + xgwp_ret = XGetWindowProperty (pDpy, w, property, 0, len, False, + XA_INTEGER, &atom_ret, &format_ret, + &nitems_ret, &after_ret, + (unsigned char **)&prop_ret); + if (xgwp_ret == Success && after_ret > 0) { len += nitems_ret * (format_ret >> 3); XFree (prop_ret); } else { break; } } - if (format_ret == 0 || nitems_ret == 0) { - /* the property does not exist or is of an unexpected type */ + if (xgwp_ret != Success || format_ret == 0 || nitems_ret == 0) { + /* the property does not exist or is of an unexpected type or + getting window property failed */ return(XcmsFailure); } |