mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 23:33:54 -06:00
migration: don't segfault on invalid input
host_from_stream_offset returns NULL on error, return error instead of trying to use that address, to avoid segfault on invalid stream. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
c57c846a80
commit
492fb99c4b
1 changed files with 3 additions and 0 deletions
|
@ -390,6 +390,9 @@ int ram_load(QEMUFile *f, void *opaque, int version_id)
|
|||
host = qemu_get_ram_ptr(addr);
|
||||
else
|
||||
host = host_from_stream_offset(f, addr, flags);
|
||||
if (!host) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ch = qemu_get_byte(f);
|
||||
memset(host, ch, TARGET_PAGE_SIZE);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue