xend_internal: don't let invalid input provoke NULL dereference

* src/xen/xend_internal.c (xenDaemonOpen_unix): Do not dereference
a NULL "conn".  Move first deref to follow the "conn == NULL" test.
This commit is contained in:
Jim Meyering 2010-01-06 12:59:21 +01:00
parent 7a90f21655
commit 7679f064bf
1 changed files with 2 additions and 1 deletions

View File

@ -748,11 +748,12 @@ int
xenDaemonOpen_unix(virConnectPtr conn, const char *path)
{
struct sockaddr_un *addr;
xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr) conn->privateData;
xenUnifiedPrivatePtr priv;
if ((conn == NULL) || (path == NULL))
return (-1);
priv = (xenUnifiedPrivatePtr) conn->privateData;
memset(&priv->addr, 0, sizeof(priv->addr));
priv->addrfamily = AF_UNIX;
/*