From: Peter Krempa Date: Mon, 6 Jun 2022 08:10:44 +0000 (+0200) Subject: qemu: Fix crash in qemuBuildDeviceCommandlineHandleOverrides X-Git-Tag: v8.5.0-rc1~207 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=95bd13721647fda869f4256c18e8b33a52f7afb6;p=thirdparty%2Flibvirt.git qemu: Fix crash in qemuBuildDeviceCommandlineHandleOverrides 'STREQ' is used to compare the override alias with the device alias. While the parser ensures that the override alias is non-NULL, the device alias may be NULL and STREQ doesn't handle that. Fixes: 38ab5c9ead5 Resolves: https://gitlab.com/libvirt/libvirt/-/issues/321 Signed-off-by: Peter Krempa Reviewed-by: Pavel Hrdina Reviewed-by: Ján Tomko --- diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 52e4ef03cd..4f4d8cf25c 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -240,6 +240,10 @@ qemuBuildDeviceCommandlineHandleOverrides(virJSONValue *props, const char *alias = virJSONValueObjectGetString(props, "id"); size_t i; + /* If the device doesn't have an alias we can't override its props */ + if (!alias) + return; + for (i = 0; i < nsdef->ndeviceOverride; i++) { qemuDomainXmlNsDeviceOverride *dev = nsdef->deviceOverride + i; size_t j;