Reviewed-by: Jeremy Huddleston <jerem...@apple.com> On Apr 19, 2010, at 10:58, Tiago Vignatti wrote:
> Both dev and dev->button are already used before their checking were being > performed. So check on the beginning. > > Signed-off-by: Tiago Vignatti <tiago.vigna...@nokia.com> > --- > Xi/xiquerydevice.c | 5 ++++- > 1 files changed, 4 insertions(+), 1 deletions(-) > > diff --git a/Xi/xiquerydevice.c b/Xi/xiquerydevice.c > index 435868d..47ab688 100644 > --- a/Xi/xiquerydevice.c > +++ b/Xi/xiquerydevice.c > @@ -247,6 +247,9 @@ ListButtonInfo(DeviceIntPtr dev, xXIButtonInfo* info, > Bool reportState) > int mask_len; > int i; > > + if (!dev || !dev->button) > + return 0; > + > mask_len = bytes_to_int32(bits_to_bytes(dev->button->numButtons)); > > info->type = ButtonClass; > @@ -259,7 +262,7 @@ ListButtonInfo(DeviceIntPtr dev, xXIButtonInfo* info, > Bool reportState) > memset(bits, 0, mask_len * 4); > > if (reportState) > - for (i = 0; dev && dev->button && i < dev->button->numButtons; i++) > + for (i = 0; i < dev->button->numButtons; i++) > if (BitIsOn(dev->button->down, i)) > SetBit(bits, i); > > -- > 1.6.0.4 > > _______________________________________________ > xorg-devel@lists.x.org: X.Org development > Archives: http://lists.x.org/archives/xorg-devel > Info: http://lists.x.org/mailman/listinfo/xorg-devel _______________________________________________ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel