[PATCH weston 1/2] screen-share: Avoid NULL dereference

Bryce Harrington bryce at osg.samsung.com
Tue Feb 21 20:29:05 UTC 2017


On Thu, Feb 16, 2017 at 07:59:50PM +0000, Daniel Stone wrote:
> Don't try to dereference the seat if it's NULL.
> 
> Signed-off-by: Daniel Stone <daniels at collabora.com>

Yep, obviously correct.

Reviewed-by: Bryce Harrington <bryce at osg.samsung.com>

> ---
>  compositor/screen-share.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/compositor/screen-share.c b/compositor/screen-share.c
> index bcb9def..069da1d 100644
> --- a/compositor/screen-share.c
> +++ b/compositor/screen-share.c
> @@ -192,7 +192,7 @@ ss_seat_handle_keymap(void *data, struct wl_keyboard *wl_keyboard,
>  	char *map_str;
>  
>  	if (!data)
> -		goto error;
> +		goto error_no_seat;
>  
>  	if (format == WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1) {
>  		map_str = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0);
> @@ -235,6 +235,7 @@ ss_seat_handle_keymap(void *data, struct wl_keyboard *wl_keyboard,
>  
>  error:
>  	wl_keyboard_release(seat->parent.keyboard);
> +error_no_seat:
>  	close(fd);
>  }
>  
> -- 
> 2.9.3
> 
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list