diff options
Diffstat (limited to 'ui/input-legacy.c')
-rw-r--r-- | ui/input-legacy.c | 5 |
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; } } |