diff -r c21b18b97a61 tools/libxc/xc_domain_restore.c --- a/tools/libxc/xc_domain_restore.c Tue Jun 05 17:05:13 2007 +0100 +++ b/tools/libxc/xc_domain_restore.c Tue Jun 05 17:40:40 2007 +0100 @@ -903,13 +903,14 @@ int xc_domain_restore(int xc_handle, int /* Get the list of PFNs that are not in the psuedo-phys map */ { - unsigned int count; + unsigned int count = 0; unsigned long *pfntab; int nr_frees, rc; - if ( !read_exact(io_fd, &count, sizeof(count)) ) - { - ERROR("Error when reading pfn count"); + if ( !read_exact(io_fd, &count, sizeof(count)) || + (count > (1U << 28)) ) /* up to 1TB of address space */ + { + ERROR("Error when reading pfn count (= %u)", count); goto out; }