Skip to content

Commit

Permalink
core: avoid uaf in resource_set_user_data
Browse files Browse the repository at this point in the history
  • Loading branch information
vaxerski committed May 18, 2024
1 parent f5181a0 commit 3afed43
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -723,11 +723,12 @@ const wl_interface {} = {{
wl_list_remove(&resourceDestroyListener.link);
wl_list_init(&resourceDestroyListener.link);
wl_resource_set_user_data(pResource, nullptr);
// if we still own the wayland resource,
// it means we need to destroy it.
if (wl_resource_get_user_data(pResource) == this)
wl_resource_destroy(pResource);
wl_resource_set_user_data(pResource, nullptr);
}}
void {}::onDestroyCalled() {{
Expand Down

0 comments on commit 3afed43

Please sign in to comment.