summaryrefslogtreecommitdiffstats
path: root/src/wayland-server.h
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@googlemail.com>2012-09-10 11:20:35 +0200
committerKristian Høgsberg <krh@bitplanet.net>2012-09-10 21:44:47 -0400
commit9fe135c46f2457d6dc694e4c02d2defeab6986b0 (patch)
tree4f05dc916c00791e77ab69eb00eb1181c4e5f595 /src/wayland-server.h
parentevent-loop: remove dead code (diff)
downloadwayland-9fe135c46f2457d6dc694e4c02d2defeab6986b0.tar
wayland-9fe135c46f2457d6dc694e4c02d2defeab6986b0.tar.gz
wayland-9fe135c46f2457d6dc694e4c02d2defeab6986b0.tar.bz2
wayland-9fe135c46f2457d6dc694e4c02d2defeab6986b0.tar.lz
wayland-9fe135c46f2457d6dc694e4c02d2defeab6986b0.tar.xz
wayland-9fe135c46f2457d6dc694e4c02d2defeab6986b0.tar.zst
wayland-9fe135c46f2457d6dc694e4c02d2defeab6986b0.zip
wayland-server: return new ID in wl_client_add_resource()
wl_client_add_resource() used to return no error even though the new resource wasn't added to the client. This currently makes it very easy to DOS weston by simply posting thousands of "create_surface" requests with an invalid ID. Weston simply assumes the wl_client_add_resource() request succeeds but will never destroy the surface again as the "destroy" signal is never called (because the surface isn't linked into the wl_map). This change makes wl_client_add_resource() return the new ID of the added object and 0 on failure. Servers (like weston) can now correctly immediately destroy the surface when this call fails instead of leaving the surface around and producing memory-leaks. Instead of returning -1 on failure and 0 on success, I made it return the new ID as this seems more appropriate. We can directly use it when calling it with new_id==0. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Diffstat (limited to 'src/wayland-server.h')
-rw-r--r--src/wayland-server.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/wayland-server.h b/src/wayland-server.h
index cd79801..3c56729 100644
--- a/src/wayland-server.h
+++ b/src/wayland-server.h
@@ -354,7 +354,7 @@ void wl_resource_post_no_memory(struct wl_resource *resource);
#include "wayland-server-protocol.h"
-void
+uint32_t
wl_client_add_resource(struct wl_client *client,
struct wl_resource *resource);