Xi: check for NULL pointer before dereferences it in ListButtonInfo
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.vignatti@nokia.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
This commit is contained in:
parent
7f457351d2
commit
057c147541
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user