From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35942) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wiq5Q-0007rr-Bq for qemu-devel@nongnu.org; Fri, 09 May 2014 15:04:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wiq5K-0005qa-4C for qemu-devel@nongnu.org; Fri, 09 May 2014 15:04:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48167) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wiq5J-0005qW-T6 for qemu-devel@nongnu.org; Fri, 09 May 2014 15:03:54 -0400 From: Stefan Hajnoczi Date: Fri, 9 May 2014 21:03:24 +0200 Message-Id: <1399662217-31148-5-git-send-email-stefanha@redhat.com> In-Reply-To: <1399662217-31148-1-git-send-email-stefanha@redhat.com> References: <1399662217-31148-1-git-send-email-stefanha@redhat.com> Subject: [Qemu-devel] [PULL 04/17] 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: Peter Maydell , Stefan Hajnoczi , Max Reitz From: 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 Signed-off-by: Stefan Hajnoczi --- 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.0