mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-10-29 05:40:16 -04:00
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 <mchqwerty@gmail.com> Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
This commit is contained in:
parent
6801d2d851
commit
88ff135ad4
1 changed files with 7 additions and 0 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue