[libvirt] [PATCH] Fix off-by-1 in QEMU boot arg array handling

Daniel P. Berrange berrange at redhat.com
Tue Aug 24 11:02:38 UTC 2010


A QEMU guest can have upto VIR_DOMAIN_BOOT_LAST boot entries
defined. When building the QEMU arg, each entry takes a
single byte. This means the array must be declared to be
VIR_DOMAIN_BOOT_LAST+1 bytes in length to allow for the
trailing null

* src/qemu/qemu_conf.c: Fix off-by-1 boot arg array size
---
 src/qemu/qemu_conf.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index aa34d63..7a37c70 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -3662,7 +3662,7 @@ int qemudBuildCommandLine(virConnectPtr conn,
 {
     int i;
     char memory[50];
-    char boot[VIR_DOMAIN_BOOT_LAST];
+    char boot[VIR_DOMAIN_BOOT_LAST+1];
     struct utsname ut;
     int disableKQEMU = 0;
     int enableKQEMU = 0;
-- 
1.7.2.1




More information about the libvir-list mailing list