mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 20:45:18 +00:00
qemu: Fix crash in virQEMUCapsProbeQMPTPM
If the queried QMP command doesn't exist qemuMonitorGetTPMModels returns 0 but sets the string list to NULL which isn't accepted by g_strv_contains. Fixes: a5bc5f0ecf8 Reported-by: Olaf Hering <olaf@aepfle.de> Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
parent
26136e3b86
commit
e7ad645a8e
@ -3168,6 +3168,9 @@ virQEMUCapsProbeQMPTPM(virQEMUCaps *qemuCaps,
|
||||
if (qemuMonitorGetTPMModels(mon, &models) < 0)
|
||||
return -1;
|
||||
|
||||
if (!models)
|
||||
return 0;
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS(virQEMUCapsTPMModelsToCaps); i++) {
|
||||
const char *needle = virDomainTPMModelTypeToString(virQEMUCapsTPMModelsToCaps[i].type);
|
||||
if (g_strv_contains((const char **)models, needle))
|
||||
@ -3177,6 +3180,9 @@ virQEMUCapsProbeQMPTPM(virQEMUCaps *qemuCaps,
|
||||
if (qemuMonitorGetTPMTypes(mon, &types) < 0)
|
||||
return -1;
|
||||
|
||||
if (!types)
|
||||
return 0;
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS(virQEMUCapsTPMTypesToCaps); i++) {
|
||||
const char *needle = virDomainTPMBackendTypeToString(virQEMUCapsTPMTypesToCaps[i].type);
|
||||
if (g_strv_contains((const char **)types, needle))
|
||||
|
Loading…
x
Reference in New Issue
Block a user