]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
esxVMX_GatherSCSIControllers: avoid NULL dereference
authorJim Meyering <meyering@redhat.com>
Wed, 14 Apr 2010 08:18:20 +0000 (10:18 +0200)
committerJim Meyering <meyering@redhat.com>
Wed, 14 Apr 2010 09:59:18 +0000 (11:59 +0200)
* src/esx/esx_vmx.c (esxVMX_GatherSCSIControllers): Do not dereference
a NULL disk->driverName.  We already detect this condition in another
case.  Check for it here, too.

src/esx/esx_vmx.c

index 647e720bc1b78b372691b7dd8f92d60e3cba30f2..c965e0017907d9481bbe1a1bae695b76226900cc 100644 (file)
@@ -570,11 +570,12 @@ esxVMX_GatherSCSIControllers(virDomainDefPtr def, char *virtualDev[4],
 
         if (virtualDev[controller] == NULL) {
             virtualDev[controller] = disk->driverName;
-        } else if (STRCASENEQ(virtualDev[controller], disk->driverName)) {
+        } else if (disk->driverName == NULL ||
+                   STRCASENEQ(virtualDev[controller], disk->driverName)) {
             ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                       _("Inconsistent driver usage ('%s' is not '%s') on SCSI "
                         "controller index %d"), virtualDev[controller],
-                      disk->driverName, controller);
+                      disk->driverName ? disk->driverName : "?", controller);
             return -1;
         }
     }