[PATCH:libX11 0/2] Followups to Kees' patches for GetReqExtra
Alan Coopersmith
alan.coopersmith at oracle.com
Tue Jul 23 22:45:12 PDT 2013
These apply on top of the patches I committed yesterday from Kees Cook.
The first replaces his bounds check with a call to the Xlib Data()
function that copies into the request buffer if there's room, otherwise
puts the data directly on the wire to the X server. This case both
simplified the code and removed a potential failure mode from
XSetModifierMapping (though a highly unlikely one, given you'd have to
have a huge number of keys per modifier to overflow the Xlib buffer size).
Tested by extracting my current modifier maps from xmodmap and then
clearing them and passing them back into xmodmap and seeing they all
set correctly.
For the second case Kees added a check for, the XAddHosts & XRemoveHosts
functions, attempting to switch to calling the Data() function just made
the code more complicated, so I left it there. (Besides, anyone trying
to pass hostname strings > 16k deserves to fail.) While working towards
that, I did take the opportunity to get rid of the mass code duplication
between those two functions, so if we do find a better way to do this in
the future, we only have to edit one copy of the code instead of two.
Alan Coopersmith (2):
XSetModifierMapping: Use Data instead of GetReqExtra
Refactor common code from XAddHost & XRemoveHost into single function
src/Host.c | 53 ++++++++++++++---------------------------------------
src/ModMap.c | 12 +++---------
2 files changed, 17 insertions(+), 48 deletions(-)
--
1.7.9.2
More information about the xorg-devel
mailing list