diff options
Diffstat (limited to 'libX11/src/AllCells.c')
-rw-r--r-- | libX11/src/AllCells.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/libX11/src/AllCells.c b/libX11/src/AllCells.c index ddd9c22ef..6e97e1181 100644 --- a/libX11/src/AllCells.c +++ b/libX11/src/AllCells.c @@ -53,8 +53,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); |