qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 11/32] vmdk: Fix vmdk_parse_extents


From: Michael Roth
Subject: [Qemu-devel] [PATCH 11/32] vmdk: Fix vmdk_parse_extents
Date: Wed, 4 Dec 2013 08:34:18 -0600

From: Fam Zheng <address@hidden>

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: address@hidden
Signed-off-by: Fam Zheng <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
(cherry picked from commit 899f1ae219d5eaa96a53c996026cb0178d62a86d)

Signed-off-by: Michael Roth <address@hidden>
---
 block/vmdk.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/block/vmdk.c b/block/vmdk.c
index 258a24f..dcee07a 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -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;
 }
-- 
1.7.9.5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]