Skip to contentSkip to conversation

hw/char: fix qcode array bounds check in ESCC impl

PATCH In review Daniel P. Berrangé 2 participants 2 messages Mar 31, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/char: fix qcode array bounds check in ESCC impl

There was an off-by-1 in the qcode conversion array bounds check.

Fixes e709a61a8fe1076a487376fd657544418a38ba06
---
 hw/char/escc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/char/escc.c +1 -1
index 8755d8d34f..17a908c59b 100644
@@ -828,7 +828,7 @@ static void sunkbd_handle_event(DeviceState *dev, QemuConsole *src,
         }
     }
 
-    if (qcode > qemu_input_map_qcode_to_sun_len) {
+    if (qcode >= qemu_input_map_qcode_to_sun_len) {
         return;
     }
 
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 16 lines · Daniel P. Berrangé

There was an off-by-1 in the qcode conversion array bounds check.

Fixes e709a61a8fe1076a487376fd657544418a38ba06
---
 hw/char/escc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/char/escc.c +0 -0
index 8755d8d34f..17a908c59b 100644

hw/char/escc.c static void sunkbd_handle_event(DeviceState *dev, QemuConsole *src, · line 833

Quoted 7 lines
hw/char/escc.c +1 -1
@@ -828,7 +828,7 @@ static void sunkbd_handle_event(DeviceState *dev, QemuConsole *src,
         }
     }
 
-    if (qcode > qemu_input_map_qcode_to_sun_len) {
+    if (qcode >= qemu_input_map_qcode_to_sun_len) {
         return;
     }

thanks
-- PMM