[PATCH weston 3/3] compositor-wayland: avoid possible NULL deref in handle_keymap
Kristian Høgsberg
hoegsberg at gmail.com
Tue May 6 15:41:35 PDT 2014
On Tue, May 06, 2014 at 02:50:03PM -0700, U. Artie Eoff wrote:
> If data is NULL, then we jumped to error which attempts to
> dereference data. Instead, just close(fd) and return when
> data is NULL.
>
> Signed-off-by: U. Artie Eoff <ullysses.a.eoff at intel.com>
All three look good, applied.
Kristian
> ---
> src/compositor-wayland.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/src/compositor-wayland.c b/src/compositor-wayland.c
> index 3cd308f..a08b71a 100644
> --- a/src/compositor-wayland.c
> +++ b/src/compositor-wayland.c
> @@ -1424,8 +1424,10 @@ input_handle_keymap(void *data, struct wl_keyboard *keyboard, uint32_t format,
> struct xkb_keymap *keymap;
> char *map_str;
>
> - if (!data)
> - goto error;
> + if (!data) {
> + close(fd);
> + return;
> + }
>
> if (format == WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1) {
> map_str = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0);
> --
> 1.9.0
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
More information about the wayland-devel
mailing list