[PATCH wayland 2/2] server: Test for illegally low interface versions in wl_global_create()

Derek Foreman derekf at osg.samsung.com
Thu Jan 14 09:02:18 PST 2016


Any version lower than 1 is unreasonable.

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

diff --git a/src/wayland-server.c b/src/wayland-server.c
index c129b7d..3a7d79d 100644
--- a/src/wayland-server.c
+++ b/src/wayland-server.c
@@ -908,6 +908,13 @@ wl_global_create(struct wl_display *display,
 	struct wl_global *global;
 	struct wl_resource *resource;
 
+	if (version < 1) {
+		wl_log("wl_global_create: failing to create interface "
+		       "'%s' with version %d because it is less than 1\n",
+			interface->name, version);
+		return NULL;
+	}
+
 	if (version > interface->version) {
 		wl_log("wl_global_create: implemented version for '%s' "
 		       "higher than interface version (%d > %d)\n",
-- 
2.7.0.rc3



More information about the wayland-devel mailing list