aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/lib/X11
diff options
context:
space:
mode:
authorErkki Seppälä <erkki.seppala@vincit.fi>2011-01-31 14:02:14 +0200
committerUlrich Sibiller <uli42@gmx.de>2016-10-19 21:40:26 +0200
commit89dc7ccfbcaf45db6ca8d5fa548568b7fb7529de (patch)
tree7839307e6ebad5c0684a78180da19d156d896002 /nx-X11/lib/X11
parent81422098f57f568499de2fba55a606c74575aba3 (diff)
downloadnx-libs-89dc7ccfbcaf45db6ca8d5fa548568b7fb7529de.tar.gz
nx-libs-89dc7ccfbcaf45db6ca8d5fa548568b7fb7529de.tar.bz2
nx-libs-89dc7ccfbcaf45db6ca8d5fa548568b7fb7529de.zip
ximcp/imTrX: Handle failing XGetWindowProperty
Checked return value of XGetWindowProperty and return false if it fails. Return value of "XGetWindowProperty(im->core.display, spec->lib_connect_wid, prop, 0L, (length + bytes_after_ret + 3UL) / 4UL, 1, 0UL, &type_ret, &format_ret, &nitems, &bytes_after_ret, &prop_ret)" is not checked Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Erkki Seppälä <erkki.seppala@vincit.fi> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
Diffstat (limited to 'nx-X11/lib/X11')
-rw-r--r--nx-X11/lib/X11/imTrX.c33
1 files changed, 21 insertions, 12 deletions
diff --git a/nx-X11/lib/X11/imTrX.c b/nx-X11/lib/X11/imTrX.c
index 6b757cee5..b81c173c5 100644
--- a/nx-X11/lib/X11/imTrX.c
+++ b/nx-X11/lib/X11/imTrX.c
@@ -377,14 +377,19 @@ _XimXGetReadData(
*ret_len = (int)nitems;
if (bytes_after_ret > 0) {
XFree(prop_ret);
- XGetWindowProperty(im->core.display,
- spec->lib_connect_wid, prop, 0L,
- ((length + bytes_after_ret + 3)/ 4), True, AnyPropertyType,
- &type_ret, &format_ret, &nitems, &bytes_after_ret,
- &prop_ret);
- XChangeProperty(im->core.display, spec->lib_connect_wid, prop,
- XA_STRING, 8, PropModePrepend, &prop_ret[length],
- (nitems - length));
+ if (XGetWindowProperty(im->core.display,
+ spec->lib_connect_wid, prop, 0L,
+ ((length + bytes_after_ret + 3)/ 4),
+ True, AnyPropertyType,
+ &type_ret, &format_ret, &nitems,
+ &bytes_after_ret,
+ &prop_ret) == Success) {
+ XChangeProperty(im->core.display, spec->lib_connect_wid, prop,
+ XA_STRING, 8, PropModePrepend, &prop_ret[length],
+ (nitems - length));
+ } else {
+ return False;
+ }
}
} else {
(void)memcpy(buf, prop_ret, buf_len);
@@ -393,10 +398,14 @@ _XimXGetReadData(
if (bytes_after_ret > 0) {
XFree(prop_ret);
- XGetWindowProperty(im->core.display,
- spec->lib_connect_wid, prop, 0L,
- ((length + bytes_after_ret + 3)/ 4), True, AnyPropertyType,
- &type_ret, &format_ret, &nitems, &bytes_after_ret, &prop_ret);
+ if (XGetWindowProperty(im->core.display,
+ spec->lib_connect_wid, prop, 0L,
+ ((length + bytes_after_ret + 3)/ 4),
+ True, AnyPropertyType,
+ &type_ret, &format_ret, &nitems,
+ &bytes_after_ret, &prop_ret) != Success) {
+ return False;
+ }
}
XChangeProperty(im->core.display, spec->lib_connect_wid, prop,
XA_STRING, 8, PropModePrepend, &prop_ret[buf_len], len);