[PATCH] Xi: check for NULL pointer before dereferences it in DeviceFocusEvent

Dan Nicholson dbn.lists at gmail.com
Sat Apr 17 08:21:20 PDT 2010


On Fri, Apr 16, 2010 at 8:42 AM, Tiago Vignatti
<tiago.vignatti at nokia.com> wrote:
> Both mouse and mouse->button are already used before their checking were being
> performed. So check on the beginning.
>
> Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
> ---
>  Xi/exevents.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/Xi/exevents.c b/Xi/exevents.c
> index e680f6f..7a1f6cf 100644
> --- a/Xi/exevents.c
> +++ b/Xi/exevents.c
> @@ -1241,6 +1241,8 @@ DeviceFocusEvent(DeviceIntPtr dev, int type, int mode, int detail,
>     int btlen, len, i;
>
>     mouse = (IsMaster(dev) || dev->u.master) ? GetMaster(dev, MASTER_POINTER) : dev;
> +    if (!mouse || !mouse->button)
> +       FatalError("no device mouse found");

Do we really want to kill the server here? Maybe just ErrorF + return
would be appropriate.

--
Dan


More information about the xorg-devel mailing list