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

Matthieu Herrb matthieu.herrb at laas.fr
Sun Mar 27 12:32:10 PDT 2011


On Sun, Mar 27, 2011 at 09:06:08PM +0200, Julien Cristau wrote:
> On Sun, Mar 27, 2011 at 19:15:18 +0200, Matthieu Herrb wrote:
> 
> > Signed-off-by: Matthieu Herrb <matthieu.herrb at laas.fr>
> > ---
> >  Xi/extinit.c |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> > 
> > diff --git a/Xi/extinit.c b/Xi/extinit.c
> > index 46d3459..5d695e3 100644
> > --- a/Xi/extinit.c
> > +++ b/Xi/extinit.c
> > @@ -429,7 +429,7 @@ static int
> >  SProcIDispatch(ClientPtr client)
> >  {
> >      REQUEST(xReq);
> > -    if (stuff->data > IREQUESTS || !SProcIVector[stuff->data])
> > +    if (stuff->data > IREQUESTS + XI2REQUESTS || !SProcIVector[stuff->data])
> >          return BadRequest;
> >  
> >      return (*SProcIVector[stuff->data])(client);
> 
> This seems dangerous if you're, say, building an X server that only
> supports XI 2.0 against the XI 2.1 headers.  Should probably be
> "if (stuff->data >= ARRAY_SIZE(SProcIVector)) ..."
> (looks like there's no ARRAY_SIZE macro outside of glx, but you get the
> idea)
> 

Well it matches the test done for the non-swapping case just 10 lines
above:

static int
ProcIDispatch(ClientPtr client)
{
    REQUEST(xReq);
    if (stuff->data > (IREQUESTS + XI2REQUESTS) || !ProcIVector[stuff->data])
        return BadRequest;

    return (*ProcIVector[stuff->data])(client);
}

-- 
Matthieu Herrb


More information about the xorg-devel mailing list