Skip to content

Commit 899f1ae

Browse files
Fam Zhengkevmw
Fam Zheng
authored andcommitted
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. Cc: [email protected] Signed-off-by: Fam Zheng <[email protected]> Signed-off-by: Kevin Wolf <[email protected]>
1 parent b681072 commit 899f1ae

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

block/vmdk.c

+5-2
Original file line numberDiff line numberDiff line change
@@ -772,10 +772,13 @@ static int vmdk_parse_extents(const char *desc, BlockDriverState *bs,
772772
}
773773
next_line:
774774
/* move to next line */
775-
while (*p && *p != '\n') {
775+
while (*p) {
776+
if (*p == '\n') {
777+
p++;
778+
break;
779+
}
776780
p++;
777781
}
778-
p++;
779782
}
780783
return 0;
781784
}

0 commit comments

Comments
 (0)