aboutsummaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2016-08-11 15:23:26 +0100
committerGerd Hoffmann <kraxel@redhat.com>2016-09-13 08:01:39 +0200
commitbba4e1b591531c087fce4ae501dc1ca299d8fb42 (patch)
tree574937d8c5459859b0708a5c68ff5be86df1a04f /ui
parent7263da78045dc91cc207f350911efe4259e99b3c (diff)
ui/curses.c: Ensure we don't read off the end of curses2qemu array
Coverity spots that there is no bounds check before we access the curses2qemu[] array. Add one, bringing this code path into line with the one that looks up entries in curses2keysym[]. In theory getch() shouldn't return out of range keycodes, but it's better not to assume this. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1470925407-23850-2-git-send-email-peter.maydell@linaro.org Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'ui')
-rw-r--r--ui/curses.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/ui/curses.c b/ui/curses.c
index b47558956c..f1f886c968 100644
--- a/ui/curses.c
+++ b/ui/curses.c
@@ -317,7 +317,10 @@ static void curses_refresh(DisplayChangeListener *dcl)
qemu_input_event_send_key_delay(0);
}
} else {
- keysym = curses2qemu[chr];
+ keysym = -1;
+ if (chr < CURSES_KEYS) {
+ keysym = curses2qemu[chr];
+ }
if (keysym == -1)
keysym = chr;