From: Marc-André Lureau <[email protected]>
Use strict "<" to fix the off-by-one.
Fixes: 6105683da35b ("ui: add an embedded Barrier client")
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3951
Reported-by: huntr bubble
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Laurent Vivier <[email protected]>
Signed-off-by: Marc-Andre Lureau <[email protected]>
(cherry picked from commit 82b4d693d522d406c950067caa4f14f45f4b679e)
(Mjt: fixup the change to before v11.0.0-365-gd276ad86eb8
"ui: rename init_keyboard_layout->kbd_layout_new()")
Signed-off-by: Michael Tokarev <[email protected]>
diff --git a/ui/input-barrier.c b/ui/input-barrier.c
index 7acc48d7046..aad520e7f56 100644
--- a/ui/input-barrier.c
+++ b/ui/input-barrier.c
@@ -87,7 +87,7 @@ static kbd_layout_t *kbd_layout;
static int input_barrier_to_qcode(uint16_t keyid, uint16_t keycode)
{
/* keycode is optional, if it is not provided use keyid */
- if (keycode && keycode <= qemu_input_map_xorgkbd_to_qcode_len) {
+ if (keycode && keycode < qemu_input_map_xorgkbd_to_qcode_len) {
return qemu_input_map_xorgkbd_to_qcode[keycode];
}
--
2.47.3