diff options
author | Kees Cook <kees@outflux.net> | 2013-06-09 11:13:42 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2013-07-22 23:51:38 -0700 |
commit | 54540d7cba0c2bfe9176221c7bca910058d304df (patch) | |
tree | 7c4470245c1df07fe0798ea594878659a9094115 /specs/libX11 | |
parent | 24d3ee0d08f24e23c91d55702f010f73d7b908e5 (diff) | |
download | xorg-lib-libX11-54540d7cba0c2bfe9176221c7bca910058d304df.tar.gz |
libX11: check size of GetReqExtra after XFlush
Two users of GetReqExtra pass arbitrarily sized allocations from the
caller (ModMap and Host). Adjust _XGetRequest() (called by the GetReqExtra
macro) to double-check the requested length and invalidate "req" when
this happens. Users of GetReqExtra passing lengths greater than the Xlib
buffer size (normally 16K) must check "req" and fail gracefully instead
of crashing.
Any callers of GetReqExtra that do not check "req" for NULL
will experience this change, in the pathological case, as a NULL
dereference instead of a buffer overflow. This is an improvement, but
the documentation for GetReqExtra has been updated to reflect the need
to check the value of "req" after the call.
Bug that manifested the problem:
https://bugs.launchpad.net/ubuntu/+source/x11-xserver-utils/+bug/792628
Signed-off-by: Kees Cook <kees@outflux.net>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'specs/libX11')
-rw-r--r-- | specs/libX11/AppC.xml | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/specs/libX11/AppC.xml b/specs/libX11/AppC.xml index df250275..0b37048f 100644 --- a/specs/libX11/AppC.xml +++ b/specs/libX11/AppC.xml @@ -2468,7 +2468,9 @@ which is the same as <function>GetReq</function> except that it takes an additional argument (the number of extra bytes to allocate in the output buffer after the request structure). -This number should always be a multiple of four. +This number should always be a multiple of four. Note that it is possible +for req to be set to NULL as a defensive measure if the requested length +exceeds the Xlib's buffer size (normally 16K). </para> </sect2> <sect2 id="Variable_Length_Arguments"> |