]> Git Repo - qemu.git/commitdiff
sheepdog: Don't truncate long VDI name in _open(), _create()
authorMarkus Armbruster <[email protected]>
Mon, 6 Mar 2017 19:00:40 +0000 (20:00 +0100)
committerKevin Wolf <[email protected]>
Tue, 7 Mar 2017 13:53:28 +0000 (14:53 +0100)
sd_parse_uri() truncates long VDI names silently.  Reject them
instead.

Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
block/sheepdog.c

index d3d373196c789b300f47dc41bf0f56509bdf0f8b..fed7264cecf88e098eb6abafbb7e8b6e168da3c3 100644 (file)
@@ -985,7 +985,10 @@ static int sd_parse_uri(BDRVSheepdogState *s, const char *filename,
         ret = -EINVAL;
         goto out;
     }
-    pstrcpy(vdi, SD_MAX_VDI_LEN, uri->path + 1);
+    if (g_strlcpy(vdi, uri->path + 1, SD_MAX_VDI_LEN) >= SD_MAX_VDI_LEN) {
+        ret = -EINVAL;
+        goto out;
+    }
 
     qp = query_params_parse(uri->query);
     if (qp->n > 1 || (s->is_unix && !qp->n) || (!s->is_unix && qp->n)) {
This page took 0.034598 seconds and 4 git commands to generate.