From 69aabecd1871a2544b12a9498ec614e705eecedd Mon Sep 17 00:00:00 2001 From: Kirill Primak Date: Tue, 3 Mar 2026 21:01:00 +0300 Subject: [PATCH] server: don't disclose the existence of invisible globals Otherwise, a client iterate over a range of names binding with deliberately incorrect interfaces and receive error messages with expected interfaces regardless of global visibility. Signed-off-by: Kirill Primak --- src/wayland-server.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/wayland-server.c b/src/wayland-server.c index 217613ff..3d2a06b6 100644 --- a/src/wayland-server.c +++ b/src/wayland-server.c @@ -1054,10 +1054,10 @@ registry_bind(struct wl_client *client, if (global->name == name) break; - if (&global->link == &display->global_list) + if (&global->link == &display->global_list || !wl_global_is_visible(client, global)) wl_resource_post_error(resource, WL_DISPLAY_ERROR_INVALID_OBJECT, - "invalid global %s (%d)", interface, name); + "global %s (%"PRIu32") is unavailable", interface, name); else if (strcmp(global->interface->name, interface) != 0) wl_resource_post_error(resource, WL_DISPLAY_ERROR_INVALID_OBJECT, @@ -1074,10 +1074,6 @@ registry_bind(struct wl_client *client, WL_DISPLAY_ERROR_INVALID_OBJECT, "invalid version for global %s (%d): have %d, wanted %d", interface, name, global->version, version); - else if (!wl_global_is_visible(client, global)) - wl_resource_post_error(resource, - WL_DISPLAY_ERROR_INVALID_OBJECT, - "invalid global %s (%d)", interface, name); else global->bind(client, global->data, version, id); }