summary refs log tree commit diff stats
path: root/ui/input-legacy.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2016-02-03 10:50:06 +0000
committerPeter Maydell <peter.maydell@linaro.org>2016-02-03 10:50:06 +0000
commitad9e1dab20253441716b769500d4c63bc39b0d51 (patch)
tree57ccddbc02a6c706c89ff44f78ee62f65f9d397c /ui/input-legacy.c
parentc65db7705b7926f4a084b93778e4bd5dd3990aad (diff)
parent64ffbe04eaafebf4045a3ace52a360c14959d196 (diff)
downloadfocaccia-qemu-ad9e1dab20253441716b769500d4c63bc39b0d51.tar.gz
focaccia-qemu-ad9e1dab20253441716b769500d4c63bc39b0d51.zip
Merge remote-tracking branch 'remotes/armbru/tags/pull-monitor-2016-02-03' into staging
Monitor patches for 2016-02-03

# gpg: Signature made Wed 03 Feb 2016 09:13:48 GMT using RSA key ID EB918653
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>"
# gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>"

* remotes/armbru/tags/pull-monitor-2016-02-03:
  hmp: fix sendkey out of bounds write (CVE-2015-8619)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'ui/input-legacy.c')
-rw-r--r--ui/input-legacy.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/ui/input-legacy.c b/ui/input-legacy.c
index 35dfc27687..3454055084 100644
--- a/ui/input-legacy.c
+++ b/ui/input-legacy.c
@@ -57,12 +57,13 @@ struct QEMUPutLEDEntry {
 static QTAILQ_HEAD(, QEMUPutLEDEntry) led_handlers =
     QTAILQ_HEAD_INITIALIZER(led_handlers);
 
-int index_from_key(const char *key)
+int index_from_key(const char *key, size_t key_length)
 {
     int i;
 
     for (i = 0; QKeyCode_lookup[i] != NULL; i++) {
-        if (!strcmp(key, QKeyCode_lookup[i])) {
+        if (!strncmp(key, QKeyCode_lookup[i], key_length) &&
+            !QKeyCode_lookup[i][key_length]) {
             break;
         }
     }