Re: [PATCH] [BUGFIX][PATCH] send-key: fix scan keycode map

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 08/22/2011 04:02 AM, KAMEZAWA Hiroyuki wrote:

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@xxxxxxxxxxxxxx>

---
  src/util/virkeycode.c |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/util/virkeycode.c b/src/util/virkeycode.c
index 4d54060..0d42767 100644
--- a/src/util/virkeycode.c
+++ b/src/util/virkeycode.c
@@ -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++) {

ACK and pushed. Converts an infinite loop back into the intended bounded array scan.

--
Eric Blake   eblake@xxxxxxxxxx    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]