[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 1/4] ui/curses.c: Ensure we don't read off the end of
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PULL 1/4] ui/curses.c: Ensure we don't read off the end of curses2qemu array |
Date: |
Tue, 13 Sep 2016 09:06:51 +0200 |
From: Peter Maydell <address@hidden>
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 <address@hidden>
Message-id: address@hidden
Signed-off-by: Gerd Hoffmann <address@hidden>
---
ui/curses.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/ui/curses.c b/ui/curses.c
index b475589..f1f886c 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;
--
1.8.3.1
- [Qemu-devel] [PULL 0/4] ui: misc small fixes for vnc, spice and curses., Gerd Hoffmann, 2016/09/13
- [Qemu-devel] [PULL 2/4] ui/curses.c: Clean up nextchr logic, Gerd Hoffmann, 2016/09/13
- [Qemu-devel] [PULL 1/4] ui/curses.c: Ensure we don't read off the end of curses2qemu array,
Gerd Hoffmann <=
- [Qemu-devel] [PULL 3/4] qemu-options.hx: correct spice options streaming-video default document value to 'off', Gerd Hoffmann, 2016/09/13
- [Qemu-devel] [PULL 4/4] vnc: fix qemu crash because of SIGSEGV, Gerd Hoffmann, 2016/09/13
- Re: [Qemu-devel] [PULL 0/4] ui: misc small fixes for vnc, spice and curses., Peter Maydell, 2016/09/13