wayland-surface: 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
This commit is contained in:
Rui Matos 2016-06-07 16:17:28 +02:00
parent a15f33ac9c
commit aa65fc8b85

View File

@ -1338,6 +1338,9 @@ xdg_surface_set_title (struct wl_client *client,
{
MetaWaylandSurface *surface = wl_resource_get_user_data (resource);
if (!g_utf8_validate (title, -1, NULL))
title = "";
meta_window_set_title (surface->window, title);
}
@ -1348,6 +1351,9 @@ xdg_surface_set_app_id (struct wl_client *client,
{
MetaWaylandSurface *surface = wl_resource_get_user_data (resource);
if (!g_utf8_validate (app_id, -1, NULL))
app_id = "";
meta_window_set_wm_class (surface->window, app_id, app_id);
}
@ -1964,6 +1970,9 @@ wl_shell_surface_set_title (struct wl_client *client,
{
MetaWaylandSurface *surface = wl_resource_get_user_data (resource);
if (!g_utf8_validate (title, -1, NULL))
title = "";
meta_window_set_title (surface->window, title);
}
@ -1974,6 +1983,9 @@ wl_shell_surface_set_class (struct wl_client *client,
{
MetaWaylandSurface *surface = wl_resource_get_user_data (resource);
if (!g_utf8_validate (class_, -1, NULL))
class_ = "";
meta_window_set_wm_class (surface->window, class_, class_);
}