vmdk: Fix vmdk_parse_extents
PATCH v2 1/1 vmdk: Fix vmdk_parse_extents
An extra 'p++' after while loop when *p == '\n' will move p to unknown data position, risking parsing junk data or memory access violation.
Signed-off-by Fam Zheng <[email protected]>
--- block/vmdk.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
block/vmdk.c +5 -2
@@ -760,10 +760,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 ; }
Signature · 1 line
1.8.3.1
Kevin Wolf
AppliedAm 11.10.2013 um 13:48 hat Fam Zheng geschrieben:
Quoted 5 lines
An extra 'p++' after while loop when *p == '\n' will move p to unknown data position, risking parsing junk data or memory access violation.
Signed-off-by Fam Zheng <[email protected]>
Thanks, applied to the block branch.
Kevin
Cc'ing [email protected].
Quoted 33 lines · Fam Zheng
An extra 'p++' after while loop when *p == '\n' will move p to unknown data position, risking parsing junk data or memory access violation.
Signed-off-by Fam Zheng <[email protected]>--- block/vmdk.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)block/vmdk.c +5
-2@@ -760,10 +760,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 ; }Signature · 1 line
1.8.3.1