[PATCH 1/4] Xi: take XI2 requests into account also for the swapping case.

Matthieu Herrb matthieu.herrb at laas.fr
Fri Apr 1 14:05:40 PDT 2011


Signed-off-by: Matthieu Herrb <matthieu.herrb at laas.fr>
---
 Xi/extinit.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/Xi/extinit.c b/Xi/extinit.c
index 46d3459..289558f 100644
--- a/Xi/extinit.c
+++ b/Xi/extinit.c
@@ -49,6 +49,7 @@ SOFTWARE.
  *  Dispatch routines and initialization routines for the X input extension.
  *
  */
+#define ARRAY_SIZE(_a)        (sizeof((_a)) / sizeof((_a)[0]))
 
 #define	 NUMTYPES 15
 
@@ -410,7 +411,7 @@ static int
 ProcIDispatch(ClientPtr client)
 {
     REQUEST(xReq);
-    if (stuff->data > (IREQUESTS + XI2REQUESTS) || !ProcIVector[stuff->data])
+    if (stuff->data > ARRAY_SIZE(ProcIVector) || !ProcIVector[stuff->data])
         return BadRequest;
 
     return (*ProcIVector[stuff->data])(client);
@@ -429,7 +430,7 @@ static int
 SProcIDispatch(ClientPtr client)
 {
     REQUEST(xReq);
-    if (stuff->data > IREQUESTS || !SProcIVector[stuff->data])
+    if (stuff->data > ARRAY_SIZE(SProcIVector) || !SProcIVector[stuff->data])
         return BadRequest;
 
     return (*SProcIVector[stuff->data])(client);
-- 
1.7.3.5



More information about the xorg-devel mailing list