[PATCH wayland] server: Fail to bind object when requested version is 0

Derek Foreman derekf at osg.samsung.com
Thu Jan 14 11:33:52 PST 2016


0 is not a valid version number for registry bind requests, so
let's check for it in registry_bind.

Signed-off-by: Derek Foreman <derekf at osg.samsung.com>
---
 src/wayland-server.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/wayland-server.c b/src/wayland-server.c
index 3a7d79d..14e2cf4 100644
--- a/src/wayland-server.c
+++ b/src/wayland-server.c
@@ -695,6 +695,11 @@ registry_bind(struct wl_client *client,
 		wl_resource_post_error(resource,
 				       WL_DISPLAY_ERROR_INVALID_OBJECT,
 				       "invalid global %s (%d)", interface, name);
+	else if (version == 0)
+		wl_resource_post_error(resource,
+				       WL_DISPLAY_ERROR_INVALID_OBJECT,
+				       "invalid version for global %s (%d): 0 is not a valid version",
+				       interface, name);
 	else if (global->version < version)
 		wl_resource_post_error(resource,
 				       WL_DISPLAY_ERROR_INVALID_OBJECT,
-- 
2.7.0.rc3



More information about the wayland-devel mailing list