On Thu, Nov 05, 2026 at 11:53:36 +0100, Peter Krempa wrote:
From: Peter Krempa <pkrempa@redhat.com>
'virCommand' requires that the error buffer is available while the process is running.
In 'qemuMigrationSrcToLegacyFile' a stack'd variable for the buffer pointer is registered, and the command is started, but it may continue executing even after return to the caller 'qemuMigrationSrcToFile' where 'virCommandWait' is called and thus if the command generates stderr after that it can overwrite the stack variable.
This happens since the function was split into multiple parts in c2518f7bc7dd4f8ab8655a12ec3a000e1eb5b232.
Fix it by moving the error buffer to 'qemuMigrationSrcToFile'. It's used for a debug message so we can move it up.
Fixes: c2518f7bc7dd4f8ab8655a12ec3a000e1eb5b232 Closes: https://gitlab.com/libvirt/libvirt/-/work_items/932 Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- src/qemu/qemu_migration.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>