Skip to contentSkip to conversation

block/nfs: Check for NULL server part

PATCH Applied Max Reitz 2 participants 2 messages May 5, 2014 – May 6, 2014 Block layer

lore
Share & tools
lore

Max Reitz

author
#0 lore raw

PATCH 1/1 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().

---
 block/nfs.c | 4 ++++
 1 file changed, 4 insertions(+)
block/nfs.c +4 -0
index 9fa831f..539bd95 100644
@@ -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");
Signature · 1 line
1.9.2