diff --git a/dump/dump.c b/dump/dump.c index 1f1a6edcab051af7bedb09ed05e3187eae45be1e..d4ef713cd06cb61edd085e8fffb27b0b4fe72fe0 100644 --- a/dump/dump.c +++ b/dump/dump.c @@ -1293,8 +1293,8 @@ static bool get_next_page(GuestPhysBlock **blockptr, uint64_t *pfnptr, memcpy(buf + addr % page_size, hbuf, n); addr += n; - if (addr % page_size == 0) { - /* we filled up the page */ + if (addr % page_size == 0 || addr >= block->target_end) { + /* we filled up the page or the current block is finished */ break; } } else {