aboutsummaryrefslogtreecommitdiff
path: root/arch_init.c
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2010-10-17 20:43:40 +0200
committerMichael S. Tsirkin <mst@redhat.com>2010-10-27 18:54:02 +0200
commit492fb99c4bef274a71178f5fab9b700c469a4230 (patch)
treedb540505d7716078ecca46cce645d90cd9538dc7 /arch_init.c
parentc57c846a80f9306aa2c6cf7efdef45ed42723fac (diff)
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>
Diffstat (limited to 'arch_init.c')
-rw-r--r--arch_init.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/arch_init.c b/arch_init.c
index a910033c8c..4caadd0c0a 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -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);