summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Huddleston Sequoia <jeremyhu@apple.com>2014-01-01 10:39:56 -0800
committerJeremy Huddleston Sequoia <jeremyhu@apple.com>2014-01-22 15:16:16 -0800
commit782fe5c174def75a9e4cb188c00c2fec72821472 (patch)
tree3bb1c55c1cce38c5fb6dbf7032cb1e85e6eab392
parent045122566c0532378b50c1af3ffec3254e416fe2 (diff)
XQuartz: Validate screen in AppleDRIQueryDirectRenderingCapable requests
Return an error to the caller rather than crashing the server on invalid screens. Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com> (cherry picked from commit b3572c0d1ab7888ac26d6b2b8be6d1d19ed9af3f)
-rw-r--r--hw/xquartz/xpr/appledri.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/hw/xquartz/xpr/appledri.c b/hw/xquartz/xpr/appledri.c
index 9aac07240..d7e984467 100644
--- a/hw/xquartz/xpr/appledri.c
+++ b/hw/xquartz/xpr/appledri.c
@@ -123,6 +123,10 @@ ProcAppleDRIQueryDirectRenderingCapable(register ClientPtr client)
rep.length = 0;
rep.sequenceNumber = client->sequence;
+ if (stuff->screen >= screenInfo.numScreens) {
+ return BadValue;
+ }
+
if (!DRIQueryDirectRenderingCapable(screenInfo.screens[stuff->screen],
&isCapable)) {
return BadValue;