From: Max Reitz Date: Mon, 5 May 2014 18:27:49 +0000 (+0200) Subject: block/nfs: Check for NULL server part X-Git-Tag: v2.1.0-rc0~132^2~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5f4d5e1aa652712ea39b6fd97114378c5c15ccda;p=thirdparty%2Fqemu.git block/nfs: Check for NULL server part 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 --- diff --git a/block/nfs.c b/block/nfs.c index 9fa831f1600..539bd951dfd 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");