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
This commit is contained in:
parent
d62491f46e
commit
2292458f5e
@ -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)
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user