From b3af1bc9d21e6bec7dfd283d91b465c9f815b6d6 Mon Sep 17 00:00:00 2001 From: "Dr. David Alan Gilbert" Date: Thu, 21 May 2015 13:24:11 +0100 Subject: Add qemu_get_counted_string to read a string prefixed by a count byte and use it in loadvm_state and ram_load. Where ever it's used, check the return and error if it failed. Minor: ram_load was using a 257 byte array for its string, the maximum length is 255 bytes + 0 terminator, so fix to 256 Signed-off-by: Dr. David Alan Gilbert Reviewed-by: Amit Shah Reviewed-by: David Gibson Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- include/migration/qemu-file.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include/migration') diff --git a/include/migration/qemu-file.h b/include/migration/qemu-file.h index a01c5b817e..318aa1ed07 100644 --- a/include/migration/qemu-file.h +++ b/include/migration/qemu-file.h @@ -312,4 +312,7 @@ static inline void qemu_get_sbe64s(QEMUFile *f, int64_t *pv) { qemu_get_be64s(f, (uint64_t *)pv); } + +size_t qemu_get_counted_string(QEMUFile *f, char buf[256]); + #endif -- cgit v1.2.1