[libvirt] [PATCH] Fix crash in LXC driver open method when URI has no path

If giving a lxc:// URI instead of lxc:/// the open method would crash ona NULL pointer * src/lxc/lxc_driver.c: Cope with a NULL URI path --- src/lxc/lxc_driver.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index 1a73ca6..6d568a3 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -126,7 +126,8 @@ static virDrvOpenStatus lxcOpen(virConnectPtr conn, return VIR_DRV_OPEN_DECLINED; /* If path isn't '/' then they typoed, tell them correct path */ - if (STRNEQ(conn->uri->path, "/")) { + if (conn->uri->path != NULL && + STRNEQ(conn->uri->path, "/")) { lxcError(VIR_ERR_INTERNAL_ERROR, _("Unexpected LXC URI path '%s', try lxc:///"), conn->uri->path); -- 1.6.5.2

On Thu, Feb 11, 2010 at 03:01:14PM +0000, Daniel P. Berrange wrote:
If giving a lxc:// URI instead of lxc:/// the open method would crash ona NULL pointer
* src/lxc/lxc_driver.c: Cope with a NULL URI path --- src/lxc/lxc_driver.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index 1a73ca6..6d568a3 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -126,7 +126,8 @@ static virDrvOpenStatus lxcOpen(virConnectPtr conn, return VIR_DRV_OPEN_DECLINED;
/* If path isn't '/' then they typoed, tell them correct path */ - if (STRNEQ(conn->uri->path, "/")) { + if (conn->uri->path != NULL && + STRNEQ(conn->uri->path, "/")) { lxcError(VIR_ERR_INTERNAL_ERROR, _("Unexpected LXC URI path '%s', try lxc:///"), conn->uri->path);
ACK, Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/
participants (2)
-
Daniel P. Berrange
-
Daniel Veillard