fix(wlr/taskbar): fix wl_array out-of-bounds access
wl_array->size contains the number of bytes in the array instead of the number of elements.pull/969/head
parent
1f620828c2
commit
ef9c3ef1cb
|
@ -367,16 +367,16 @@ void Task::handle_output_leave(struct wl_output *output)
|
||||||
void Task::handle_state(struct wl_array *state)
|
void Task::handle_state(struct wl_array *state)
|
||||||
{
|
{
|
||||||
state_ = 0;
|
state_ = 0;
|
||||||
for (auto* entry = static_cast<uint32_t*>(state->data);
|
size_t size = state->size / sizeof(uint32_t);
|
||||||
entry < static_cast<uint32_t*>(state->data) + state->size;
|
for (size_t i = 0; i < size; ++i) {
|
||||||
entry++) {
|
auto entry = static_cast<uint32_t*>(state->data)[i];
|
||||||
if (*entry == ZWLR_FOREIGN_TOPLEVEL_HANDLE_V1_STATE_MAXIMIZED)
|
if (entry == ZWLR_FOREIGN_TOPLEVEL_HANDLE_V1_STATE_MAXIMIZED)
|
||||||
state_ |= MAXIMIZED;
|
state_ |= MAXIMIZED;
|
||||||
if (*entry == ZWLR_FOREIGN_TOPLEVEL_HANDLE_V1_STATE_MINIMIZED)
|
if (entry == ZWLR_FOREIGN_TOPLEVEL_HANDLE_V1_STATE_MINIMIZED)
|
||||||
state_ |= MINIMIZED;
|
state_ |= MINIMIZED;
|
||||||
if (*entry == ZWLR_FOREIGN_TOPLEVEL_HANDLE_V1_STATE_ACTIVATED)
|
if (entry == ZWLR_FOREIGN_TOPLEVEL_HANDLE_V1_STATE_ACTIVATED)
|
||||||
state_ |= ACTIVE;
|
state_ |= ACTIVE;
|
||||||
if (*entry == ZWLR_FOREIGN_TOPLEVEL_HANDLE_V1_STATE_FULLSCREEN)
|
if (entry == ZWLR_FOREIGN_TOPLEVEL_HANDLE_V1_STATE_FULLSCREEN)
|
||||||
state_ |= FULLSCREEN;
|
state_ |= FULLSCREEN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue