From faa4b09b9fbbe0080d4db587119056e52831d37f Mon Sep 17 00:00:00 2001 From: CismonX Date: Wed, 14 Oct 2026 22:00:31 +0800 Subject: input: no need to strip trailing NULs from keymap Since libxkbcommon 1.6.0, xkb_keymap_new_from_buffer() allows a NUL-terminated string as keymap text [1]. Also the keymap text cannot have multiple trailing NULs according to the Wayland protocol spec. This also avoids length mismatch for munmap(), which may leak resource when 'size % sysconf(_SC_PAGESIZE) == 1'. Also see the original patch [2] which reported this issue. [1]: https://github.com/xkbcommon/libxkbcommon/commit/b06aedb8ba [2]: https://codeberg.org/dnkl/foot/pulls/2482 --- input.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'input.c') diff --git a/input.c b/input.c index 643a18d7..ed85dbb8 100644 --- a/input.c +++ b/input.c @@ -600,9 +600,6 @@ keyboard_keymap(void *data, struct wl_keyboard *wl_keyboard, goto err; } - while (map_str[size - 1] == '\0') - size--; - if (seat->kbd.xkb != NULL) { seat->kbd.xkb_keymap = xkb_keymap_new_from_buffer( seat->kbd.xkb, map_str, size, XKB_KEYMAP_FORMAT_TEXT_V1, -- cgit v1.3