mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
qemu: Check for valid save image format when verifying image header
When attempting to restore a saved image, the check for a valid save image format does not occur until the qemu process is about to be executed. Move the check earlier in the restore process, along with the other checks that verify a valid save image header. Signed-off-by: Jim Fehlig <jfehlig@suse.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
517248e239
commit
4118e79f3e
@ -289,6 +289,12 @@ qemuSaveImageReadHeader(int fd, virQEMUSaveData **ret_data)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (header->format >= QEMU_SAVE_FORMAT_LAST) {
|
||||
virReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("unsupported save image format: %1$d"), header->format);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (header->data_len <= 0) {
|
||||
virReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("invalid header data length: %1$d"), header->data_len);
|
||||
|
Loading…
x
Reference in New Issue
Block a user