Skip to content
Snippets Groups Projects
Commit 09eb64f9 authored by Alexander Ivanov's avatar Alexander Ivanov Committed by Denis V. Lunev
Browse files

parallels: Check if data_end greater than the file size


Initially data_end is set to the data_off image header field and must not
be greater than the file size.

Signed-off-by: default avatarAlexander Ivanov <alexander.ivanov@virtuozzo.com>
Reviewed-by: default avatarDenis V. Lunev <den@openvz.org>
Signed-off-by: default avatarDenis V. Lunev <den@openvz.org>
parent fcadb486
No related branches found
No related tags found
No related merge requests found
......@@ -874,6 +874,11 @@ static int parallels_open(BlockDriverState *bs, QDict *options, int flags,
*/
s->header_size = size;
}
if (s->data_end > file_nb_sectors) {
error_setg(errp, "Invalid image: incorrect data_off field");
ret = -EINVAL;
goto fail;
}
ret = bdrv_pread(bs->file, 0, s->header_size, s->header, 0);
if (ret < 0) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment