Commit 2a1fbb18 authored by Alan Coopersmith's avatar Alan Coopersmith Committed by Ulrich Sibiller

unvalidated lengths in XAllocColorCells() [CVE-2013-1997 1/15]

If a broken server returned larger than requested values for nPixels or nMasks, XAllocColorCells would happily overflow the buffers provided by the caller to write the results into. Reported-by: 's avatarIlja Van Sprundel <ivansprundel@ioactive.com> Signed-off-by: 's avatarAlan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: 's avatarMatthieu Herrb <matthieu.herrb@laas.fr> Signed-off-by: 's avatarJulien Cristau <jcristau@debian.org> Backported-to-NX-by: 's avatarUlrich Sibiller <uli42@gmx.de>
parent e03f3922
......@@ -54,8 +54,13 @@ Status XAllocColorCells(
status = _XReply(dpy, (xReply *)&rep, 0, xFalse);
if (status) {
_XRead32 (dpy, (long *) pixels, 4L * (long) (rep.nPixels));
_XRead32 (dpy, (long *) masks, 4L * (long) (rep.nMasks));
if ((rep.nPixels > ncolors) || (rep.nMasks > nplanes)) {
_XEatDataWords(dpy, rep.length);
status = 0; /* Failure */
} else {
_XRead32 (dpy, (long *) pixels, 4L * (long) (rep.nPixels));
_XRead32 (dpy, (long *) masks, 4L * (long) (rep.nMasks));
}
}
UnlockDisplay(dpy);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment