xwayland: Update output nameLength

At creation, Xwayland uses a generic output name ("XWAYLAND0", etc.) for
the XRandR outputs, and later, once the name is known from the Wayland
protocols, updates the output names using the actual names from the
Wayland compositor.

However, when doing so, it simply updates the string, the "nameLength"
isn't updated, so the name passed to the clients might either end up
being truncated or contain portions of the previous (initial) output
name.

Note, this is using a fixed size buffer initialized with zeros, so this
cannot leak any data other than the previous output name, so this is
mainly a cosmetic issue.

Update the output's "nameLength" when updating the output name.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Fixes: 3c07a01c42 - xwayland: Use xdg-output name for XRandR
Reviewed-by: Simon Ser <contact@emersion.fr>
This commit is contained in:
Olivier Fourdan 2023-12-01 14:12:21 +01:00 committed by Olivier Fourdan
parent eb6125f20c
commit 0e314afef6

View File

@ -683,6 +683,7 @@ xwl_output_set_name(struct xwl_output *xwl_output, const char *name)
}
snprintf(xwl_output->randr_output->name, MAX_OUTPUT_NAME, "%s", name);
xwl_output->randr_output->nameLength = strlen(xwl_output->randr_output->name);
}
static void