On Tue, Dec 15, 2009 at 04:09:06PM +0100, Jim Meyering wrote:
The offending code starts here:
int
esxVMX_ParseSCSIController(virConnectPtr conn, virConfPtr conf, int controller,
int *present, char **virtualDev)
{
char present_name[32];
char virtualDev_name[32];
if (virtualDev == NULL || *virtualDev != NULL) {
ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
goto failure;
}
If the virtualDev parameter is NULL, then we'd issue the
diagnostic and take the "goto", and (below), dereference NULL.
>From 79283ba1d667534175d4c48079e6b500feba6480 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Tue, 15 Dec 2009 16:07:10 +0100
Subject: [PATCH] esx_vmx.c: don't dereference NULL for a NULL virtualDev
* src/esx/esx_vmx.c (esxVMX_ParseSCSIController): Don't deref
"virtualDev" when it is NULL.
---
src/esx/esx_vmx.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/src/esx/esx_vmx.c b/src/esx/esx_vmx.c
index f5b4544..404617e 100644
--- a/src/esx/esx_vmx.c
+++ b/src/esx/esx_vmx.c
@@ -1204,7 +1204,8 @@ esxVMX_ParseSCSIController(virConnectPtr conn, virConfPtr conf, int
controller,
return 0;
failure:
- VIR_FREE(*virtualDev);
+ if (virtualDev)
+ VIR_FREE(*virtualDev);
return -1;
}
--
ACK
Daniel
--
|: Red Hat, Engineering, London -o-
http://people.redhat.com/berrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org -o-
http://ovirt.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|