diff options
author | Rui Matos <tiagomatos@gmail.com> | 2016-06-07 16:17:28 +0200 |
---|---|---|
committer | Rui Matos <tiagomatos@gmail.com> | 2016-06-07 20:17:39 +0200 |
commit | 2292458f5e94138b78c0e140fdbec45e7f6c656f (patch) | |
tree | 08b28c22e27f691513d065dec61401fe0eda23e3 /src | |
parent | d62491f46eba748ece8298886ff75ad337ac6fc6 (diff) | |
download | mutter-2292458f5e94138b78c0e140fdbec45e7f6c656f.tar.gz |
wayland/*-shell: UTF-8 validate title, class and app ID strings
The protocol says these must be UTF-8 so let's ensure they are.
https://bugzilla.gnome.org/show_bug.cgi?id=752788
Diffstat (limited to 'src')
-rw-r--r-- | src/wayland/meta-wayland-wl-shell.c | 8 | ||||
-rw-r--r-- | src/wayland/meta-wayland-xdg-shell.c | 6 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/wayland/meta-wayland-wl-shell.c b/src/wayland/meta-wayland-wl-shell.c index 2557eea64..29b89f654 100644 --- a/src/wayland/meta-wayland-wl-shell.c +++ b/src/wayland/meta-wayland-wl-shell.c @@ -400,6 +400,10 @@ wl_shell_surface_set_title (struct wl_client *client, surface_from_wl_shell_surface_resource (resource); g_clear_pointer (&wl_shell_surface->title, g_free); + + if (!g_utf8_validate (title, -1, NULL)) + title = ""; + wl_shell_surface->title = g_strdup (title); if (surface->window) @@ -417,6 +421,10 @@ wl_shell_surface_set_class (struct wl_client *client, surface_from_wl_shell_surface_resource (resource); g_clear_pointer (&wl_shell_surface->wm_class, g_free); + + if (!g_utf8_validate (class_, -1, NULL)) + class_ = ""; + wl_shell_surface->wm_class = g_strdup (class_); if (surface->window) diff --git a/src/wayland/meta-wayland-xdg-shell.c b/src/wayland/meta-wayland-xdg-shell.c index 4c5e972ed..240970c08 100644 --- a/src/wayland/meta-wayland-xdg-shell.c +++ b/src/wayland/meta-wayland-xdg-shell.c @@ -136,6 +136,9 @@ xdg_surface_set_title (struct wl_client *client, { MetaWaylandSurface *surface = surface_from_xdg_surface_resource (resource); + if (!g_utf8_validate (title, -1, NULL)) + title = ""; + meta_window_set_title (surface->window, title); } @@ -146,6 +149,9 @@ xdg_surface_set_app_id (struct wl_client *client, { MetaWaylandSurface *surface = surface_from_xdg_surface_resource (resource); + if (!g_utf8_validate (app_id, -1, NULL)) + app_id = ""; + meta_window_set_wm_class (surface->window, app_id, app_id); } |