From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53910) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WhNcU-0004ip-Lx for qemu-devel@nongnu.org; Mon, 05 May 2014 14:28:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WhNcO-00012d-GW for qemu-devel@nongnu.org; Mon, 05 May 2014 14:28:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39132) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WhNcO-00012M-9Y for qemu-devel@nongnu.org; Mon, 05 May 2014 14:28:00 -0400 From: Max Reitz Date: Mon, 5 May 2014 20:27:49 +0200 Message-Id: <1399314469-14211-1-git-send-email-mreitz@redhat.com> Subject: [Qemu-devel] [PATCH] block/nfs: Check for NULL server part List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Peter Lieven , Stefan Hajnoczi , Max Reitz After the URL has been parsed make sure the server part is valid in order to avoid a segmentation fault when calling nfs_mount(). Signed-off-by: Max Reitz --- block/nfs.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/block/nfs.c b/block/nfs.c index 9fa831f..539bd95 100644 --- a/block/nfs.c +++ b/block/nfs.c @@ -256,6 +256,10 @@ static int64_t nfs_client_open(NFSClient *client, const char *filename, error_setg(errp, "Invalid URL specified"); goto fail; } + if (!uri->server) { + error_setg(errp, "Invalid URL specified"); + goto fail; + } strp = strrchr(uri->path, '/'); if (strp == NULL) { error_setg(errp, "Invalid URL specified"); -- 1.9.2