Am 29.01.2013 07:41, schrieb Peter Hutterer:
> From: Ted Felix <t...@tedfelix.com>
> 
> If acpid sends a string in a format that we can't parse, bail out instead of
> potentially dereferencing a NULL-pointer.
> 
> X.Org Bug 73227 <http://bugs.freedesktop.org/show_bug.cgi?id=73227>
> 
> Reviewed-by: Peter Hutterer <peter.hutte...@who-t.net>
> Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net>
> ---
> Ted, can I have your Signed-off-by for this patch?
> 
>  hw/xfree86/os-support/linux/lnx_acpi.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/xfree86/os-support/linux/lnx_acpi.c 
> b/hw/xfree86/os-support/linux/lnx_acpi.c
> index d98efa2..dcaa19e 100644
> --- a/hw/xfree86/os-support/linux/lnx_acpi.c
> +++ b/hw/xfree86/os-support/linux/lnx_acpi.c
> @@ -82,18 +82,21 @@ lnxACPIGetEventFromOs(int fd, pmEvent * events, int num)
>  
>          video = strtok(ev, " ");
>  
> -        GFX = strtok(NULL, " ");
> +        if (!(GFX = strtok(NULL, " ")))
> +            return 0;
>  #if 0
>          ErrorF("GFX: %s\n", GFX);
>  #endif
>  
> -        notify = strtok(NULL, " ");
> +        if (!(notify = strtok(NULL, " ")))
> +            return 0;
>          notify_l = strtoul(notify, NULL, 16);
>  #if 0
>          ErrorF("notify: 0x%lx\n", notify_l);
>  #endif
>  
> -        data = strtok(NULL, " ");
> +        if (!(data = strtok(NULL, " ")))
> +            return 0;
>          data_l = strtoul(data, NULL, 16);
>  #if 0
>          ErrorF("data: 0x%lx\n", data_l);

it would make reading more easy if you use:

data = strtok(NULL, " ");
if (!data)
        return 0;


just my 2 cents,
 re
 wh



_______________________________________________
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

Reply via email to