mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 14:15:28 +00:00
send-key: fix scan keycode map
Now, bad key-code in send-key can cause segmentation fault in libvirt. (example) % virsh send-key --codeset win32 12 error: End of file while reading data: Input/output error This is caused by overrun at scanning keycode array. Fix it. Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
This commit is contained in:
parent
6611d9ebcc
commit
9f5afc732c
@ -118,7 +118,7 @@ static int __virKeycodeValueTranslate(unsigned int from_offset,
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; ARRAY_CARDINALITY(virKeycodes); i++) {
|
||||
for (i = 0; i < ARRAY_CARDINALITY(virKeycodes); i++) {
|
||||
if (getfield(virKeycodes + i, unsigned short, from_offset) == key_value)
|
||||
return getfield(virKeycodes + i, unsigned short, to_offset);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user