]> xenbits.xensource.com Git - qemu-upstream-4.5-testing.git/commitdiff
vmdk: Fix vmdk_parse_extents
authorFam Zheng <famz@redhat.com>
Fri, 11 Oct 2013 11:48:29 +0000 (19:48 +0800)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Tue, 3 Dec 2013 20:08:26 +0000 (14:08 -0600)
An extra 'p++' after while loop when *p == '\n' will move p to unknown
data position, risking parsing junk data or memory access violation.

Cc: qemu-stable@nongnu.org
Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 899f1ae219d5eaa96a53c996026cb0178d62a86d)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
block/vmdk.c

index 258a24f3cd7c0d30704bbc89f0765be0807402b6..dcee07a3082777a3808b27969b990962bee217a3 100644 (file)
@@ -755,10 +755,13 @@ static int vmdk_parse_extents(const char *desc, BlockDriverState *bs,
         }
 next_line:
         /* move to next line */
-        while (*p && *p != '\n') {
+        while (*p) {
+            if (*p == '\n') {
+                p++;
+                break;
+            }
             p++;
         }
-        p++;
     }
     return 0;
 }