[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 12/13] vmdk: Allow space in file name
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PATCH 12/13] vmdk: Allow space in file name |
Date: |
Fri, 1 Feb 2013 15:28:03 +0100 |
From: Philipp Hahn <address@hidden>
The previous scanf() format string stopped parsing the file name on the
first white white space, which seems to be allowed at least by VMware
Workstation.
Change the format string to collect everything between the first and
second quote as the file name, disallowing line breaks.
Signed-off-by: Philipp Hahn <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
block/vmdk.c | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/block/vmdk.c b/block/vmdk.c
index a8cb5c9..aef1abc 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -641,7 +641,7 @@ static int vmdk_parse_extents(const char *desc,
BlockDriverState *bs,
* RW [size in sectors] SPARSE "file-name.vmdk"
*/
flat_offset = -1;
- ret = sscanf(p, "%10s %" SCNd64 " %10s %511s %" SCNd64,
+ ret = sscanf(p, "%10s %" SCNd64 " %10s \"%511[^\n\r\"]\" %" SCNd64,
access, §ors, type, fname, &flat_offset);
if (ret < 4 || strcmp(access, "RW")) {
goto next_line;
@@ -653,14 +653,6 @@ static int vmdk_parse_extents(const char *desc,
BlockDriverState *bs,
return -EINVAL;
}
- /* trim the quotation marks around */
- if (fname[0] == '"') {
- memmove(fname, fname + 1, strlen(fname));
- if (strlen(fname) <= 1 || fname[strlen(fname) - 1] != '"') {
- return -EINVAL;
- }
- fname[strlen(fname) - 1] = '\0';
- }
if (sectors <= 0 ||
(strcmp(type, "FLAT") && strcmp(type, "SPARSE")) ||
(strcmp(access, "RW"))) {
--
1.8.1
- [Qemu-devel] [PATCH 03/13] block: Adds mirroring tests for resized images, (continued)
- [Qemu-devel] [PATCH 03/13] block: Adds mirroring tests for resized images, Stefan Hajnoczi, 2013/02/01
- [Qemu-devel] [PATCH 04/13] vmdk: Allow selecting SCSI adapter in image creation, Stefan Hajnoczi, 2013/02/01
- [Qemu-devel] [PATCH 05/13] sheepdog: pass vdi_id to sheep daemon for sd_close(), Stefan Hajnoczi, 2013/02/01
- [Qemu-devel] [PATCH 07/13] cloop: Fix bdrv_open() error handling, Stefan Hajnoczi, 2013/02/01
- [Qemu-devel] [PATCH 06/13] bochs: Fix bdrv_open() error handling, Stefan Hajnoczi, 2013/02/01
- [Qemu-devel] [PATCH 09/13] dmg: Fix bdrv_open() error handling, Stefan Hajnoczi, 2013/02/01
- [Qemu-devel] [PATCH 08/13] vpc: Fix bdrv_open() error handling, Stefan Hajnoczi, 2013/02/01
- [Qemu-devel] [PATCH 10/13] dmg: Use g_free instead of free, Stefan Hajnoczi, 2013/02/01
- [Qemu-devel] [PATCH 11/13] parallels: Fix bdrv_open() error handling, Stefan Hajnoczi, 2013/02/01
- [Qemu-devel] [PATCH 12/13] vmdk: Allow space in file name,
Stefan Hajnoczi <=
- [Qemu-devel] [PATCH 13/13] block/raw-posix: Build fix for O_ASYNC, Stefan Hajnoczi, 2013/02/01