diff mbox series

[PULL,v3,17/24] qga: fix an off-by-one issue

Message ID 20181031141925.30026-18-mdroth@linux.vnet.ibm.com
State New
Headers show
Series [PULL,v3,01/24] qga: Support Unicode paths in guest-file-open on win32 | expand

Commit Message

Michael Roth Oct. 31, 2018, 2:19 p.m. UTC
From: Li Qiang <liq3ea@gmail.com>

Signed-off-by: Li Qiang <liq3ea@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 qga/commands-win32.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/qga/commands-win32.c b/qga/commands-win32.c
index a1b7512d46..ef1d7d48d2 100644
--- a/qga/commands-win32.c
+++ b/qga/commands-win32.c
@@ -485,7 +485,7 @@  static STORAGE_BUS_TYPE win2qemu[] = {
 
 static GuestDiskBusType find_bus_type(STORAGE_BUS_TYPE bus)
 {
-    if (bus > ARRAY_SIZE(win2qemu) || (int)bus < 0) {
+    if (bus >= ARRAY_SIZE(win2qemu) || (int)bus < 0) {
         return GUEST_DISK_BUS_TYPE_UNKNOWN;
     }
     return win2qemu[(int)bus];