summaryrefslogtreecommitdiff
path: root/Xext/EVI.c
diff options
context:
space:
mode:
authorAlan Hourihane <alanh@tungstengraphics.com>2008-02-27 17:30:21 +0000
committerAlan Hourihane <alanh@tungstengraphics.com>2008-02-27 17:30:21 +0000
commit8689f7e348671f65e4b8c425ea4674fa33fc2900 (patch)
tree55e6d0af861c23466263508d6935b05e305c4d9d /Xext/EVI.c
parent06a58f2d5363e13069315beac8934cca1aab54db (diff)
parent41aea6194bd29ab34cc166b3fd90eee64299ddf8 (diff)
Merge branch 'master' of git+ssh://git.freedesktop.org/git/xorg/xserver into glucose-2
Conflicts: hw/xfree86/Makefile.am hw/xfree86/dri/dri.c hw/xfree86/dri/dristruct.h hw/xgl/glx/xglx.c hw/xgl/xglscreen.c render/picture.c
Diffstat (limited to 'Xext/EVI.c')
-rw-r--r--Xext/EVI.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/Xext/EVI.c b/Xext/EVI.c
index 4bd050ca7..a637bae5d 100644
--- a/Xext/EVI.c
+++ b/Xext/EVI.c
@@ -34,6 +34,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <X11/extensions/XEVIstr.h>
#include "EVIstruct.h"
#include "modinit.h"
+#include "scrnintstr.h"
static EviPrivPtr eviPriv;
@@ -84,10 +85,22 @@ ProcEVIGetVisualInfo(ClientPtr client)
{
REQUEST(xEVIGetVisualInfoReq);
xEVIGetVisualInfoReply rep;
- int n, n_conflict, n_info, sz_info, sz_conflict;
+ int i, n, n_conflict, n_info, sz_info, sz_conflict;
VisualID32 *conflict;
+ unsigned int total_visuals = 0;
xExtendedVisualInfo *eviInfo;
int status;
+
+ /*
+ * do this first, otherwise REQUEST_FIXED_SIZE can overflow. we assume
+ * here that you don't have more than 2^32 visuals over all your screens;
+ * this seems like a safe assumption.
+ */
+ for (i = 0; i < screenInfo.numScreens; i++)
+ total_visuals += screenInfo.screens[i]->numVisuals;
+ if (stuff->n_visual > total_visuals)
+ return BadValue;
+
REQUEST_FIXED_SIZE(xEVIGetVisualInfoReq, stuff->n_visual * sz_VisualID32);
status = eviPriv->getVisualInfo((VisualID32 *)&stuff[1], (int)stuff->n_visual,
&eviInfo, &n_info, &conflict, &n_conflict);