[mutter] wayland/*-shell: UTF-8 validate title, class and app ID strings
- From: Rui Matos <rtcm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] wayland/*-shell: UTF-8 validate title, class and app ID strings
- Date: Tue, 7 Jun 2016 18:22:59 +0000 (UTC)
commit 2292458f5e94138b78c0e140fdbec45e7f6c656f
Author: Rui Matos <tiagomatos gmail com>
Date: Tue Jun 7 16:17:28 2016 +0200
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
src/wayland/meta-wayland-wl-shell.c | 8 ++++++++
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 2557eea..29b89f6 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 4c5e972..240970c 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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]