From: Derek Foreman Date: Fri, 15 Jan 2016 16:06:48 +0000 (-0600) Subject: server: validate resource versions at creation time X-Git-Tag: 1.10.91~40 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=88ff135ad46b556b6fdeb1244ffd019a262967bc;p=platform%2Fupstream%2Fwayland.git server: validate resource versions at creation time We shouldn't ever create a resource with version less than 1 or greater than the interface version. Reviewed-by: Marek Chalupa Signed-off-by: Derek Foreman --- diff --git a/src/wayland-server.c b/src/wayland-server.c index ae9365f..67cdd0c 100644 --- a/src/wayland-server.c +++ b/src/wayland-server.c @@ -1390,6 +1390,13 @@ wl_resource_create(struct wl_client *client, { struct wl_resource *resource; + if (version < 1 || version > interface->version) { + wl_log("wl_resource_create: invalid resource version %d " + "for interface '%s' - must be in range [1, %d]\n", + version, interface->name, interface->version); + return NULL; + } + resource = malloc(sizeof *resource); if (resource == NULL) return NULL;