From: Jim Meyering Date: Wed, 14 Apr 2010 08:18:20 +0000 (+0200) Subject: esxVMX_GatherSCSIControllers: avoid NULL dereference X-Git-Tag: v0.8.1~151 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dc8dd7f8db9de013ef9481bed933bd4f970af4fc;p=thirdparty%2Flibvirt.git esxVMX_GatherSCSIControllers: avoid NULL dereference * 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. --- diff --git a/src/esx/esx_vmx.c b/src/esx/esx_vmx.c index 647e720bc1..c965e00179 100644 --- a/src/esx/esx_vmx.c +++ b/src/esx/esx_vmx.c @@ -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; } }