mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-06-15 14:33:01 -04:00
xwayland: stop using xcb_get_property_reply_t.value_len
This field is difficult to use correctly, its meaning depends on
format.
xcb docs read:
> You should use the corresponding accessor instead of this field.
Replace all uses with the safe accessor.
This fixes potential out-of-bounds array accesses when the format
field isn't what we expect.
(cherry picked from commit c91543352a)
This commit is contained in:
parent
9d4fc33b87
commit
1aac9974d5
2 changed files with 14 additions and 11 deletions
|
|
@ -344,7 +344,8 @@ static bool source_get_targets(struct wlr_xwm_selection *selection,
|
|||
}
|
||||
|
||||
const xcb_atom_t *value = xcb_get_property_value(reply);
|
||||
for (uint32_t i = 0; i < reply->value_len; i++) {
|
||||
uint32_t value_len = xcb_get_property_value_length(reply) / sizeof(value);
|
||||
for (uint32_t i = 0; i < value_len; i++) {
|
||||
char *mime_type = NULL;
|
||||
|
||||
if (value[i] == xwm->atoms[UTF8_STRING]) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue