From 0e314afef62b1d03c67273a8479bfdf8fe9f2573 Mon Sep 17 00:00:00 2001 From: Olivier Fourdan Date: Fri, 1 Dec 2023 14:12:21 +0100 Subject: [PATCH] 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 Fixes: 3c07a01c42 - xwayland: Use xdg-output name for XRandR Reviewed-by: Simon Ser --- hw/xwayland/xwayland-output.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c index f26fb5a4f..5884402d1 100644 --- a/hw/xwayland/xwayland-output.c +++ b/hw/xwayland/xwayland-output.c @@ -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