mirror of
https://gitlab.freedesktop.org/xorg/lib/libx11.git
synced 2026-04-20 10:40:43 +02:00
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>
This commit is contained in:
parent
2ace8d5c89
commit
79a5c86e02
1 changed files with 21 additions and 12 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue