[Libvirt-cim] [PATCH] Fix potiential seg fault if user doesn't specify BootDevices attribute

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Wed Jun 10 23:42:51 UTC 2009


# HG changeset patch
# User Kaitlin Rupert <karupert at us.ibm.com>
# Date 1244676797 25200
# Node ID fc8f08ab36dac00f5e8bc3f2a1d160d1a57fdc78
# Parent  6107c1026ed44acaf24ce9430a0e6dd2fa97f252
Fix potiential seg fault if user doesn't specify BootDevices attribute

If the user doesn't specify the BootDevices attribute, then we should return
from the bootord_vssd_to_domain().  Otherwise, the provider will seg fault when
it tries to get the length of the array.  Since specifying a boot order is
optional, set the boot order count to 0 and return.

Signed-off-by: Kaitlin Rupert <karupert at us.ibm.com>

diff -r 6107c1026ed4 -r fc8f08ab36da src/Virt_VirtualSystemManagementService.c
--- a/src/Virt_VirtualSystemManagementService.c	Mon Jun 01 18:19:42 2009 -0300
+++ b/src/Virt_VirtualSystemManagementService.c	Wed Jun 10 16:33:17 2009 -0700
@@ -213,9 +213,11 @@
 
         ret = cu_get_array_prop(inst, "BootDevices", &bootlist);
       
-        if (ret != CMPI_RC_OK)  
+        if (ret != CMPI_RC_OK) {
                 CU_DEBUG("Failed to get BootDevices property"); 
-
+                domain->os_info.fv.bootlist_ct = 0;
+                goto out;
+        }
        
         bl_size = CMGetArrayCount(bootlist, &s);
         if (s.rc != CMPI_RC_OK) {
@@ -256,6 +258,8 @@
         domain->os_info.fv.bootlist_ct = bl_size;
         domain->os_info.fv.bootlist = tmp_str_arr;
 
+ out:
+
         return 1;
 }
 




More information about the Libvirt-cim mailing list