From 414b0e56a640015d6ba0bc29a8a1d36348c76d72 Mon Sep 17 00:00:00 2001 From: Alex Jia Date: Thu, 16 Feb 2012 10:32:03 +0800 Subject: qemu: Prevent crash of libvirtd without guest agent * src/qemu/qemu_process.c (qemuFindAgentConfig): avoid crash libvirtd due to deref a NULL pointer. * How to reproduce? 1. virsh edit the following xml into guest configuration: 2. virsh start or % virt-install -n foo -r 1024 --disk path=/var/lib/libvirt/images/foo.img,size=1 \ --channel pty,target_type=virtio -l Signed-off-by: Alex Jia --- src/qemu/qemu_process.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 2d92d66a0..ac9496156 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -193,7 +193,7 @@ qemuFindAgentConfig(virDomainDefPtr def) if (channel->targetType != VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO) continue; - if (STREQ(channel->target.name, "org.qemu.guest_agent.0")) { + if (STREQ_NULLABLE(channel->target.name, "org.qemu.guest_agent.0")) { config = &channel->source; break; } -- cgit v1.2.3-65-gdbad