If PyDict_Check fails, we should force an error rather than blindly continuing on.
Signed-off-by: John Ferlan <jfer...@redhat.com> --- libvirt-override.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/libvirt-override.c b/libvirt-override.c index 0353306..8748101 100644 --- a/libvirt-override.c +++ b/libvirt-override.c @@ -7861,6 +7861,11 @@ libvirt_virDomainMigrate3(PyObject *self ATTRIBUTE_UNUSED, domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain); dconn = (virConnectPtr) PyvirConnect_Get(pyobj_dconn); + if (!PyDict_Check(dict)) { + PyErr_Format(PyExc_TypeError, "migration params must be a dictionary"); + return NULL; + } + if (virPyDictToTypedParams(dict, ¶ms, &nparams, virPyDomainMigrate3Params, VIR_N_ELEMENTS(virPyDomainMigrate3Params)) < 0) { @@ -7894,6 +7899,11 @@ libvirt_virDomainMigrateToURI3(PyObject *self ATTRIBUTE_UNUSED, domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain); + if (!PyDict_Check(dict)) { + PyErr_Format(PyExc_TypeError, "migration params must be a dictionary"); + return NULL; + } + if (virPyDictToTypedParams(dict, ¶ms, &nparams, virPyDomainMigrate3Params, VIR_N_ELEMENTS(virPyDomainMigrate3Params)) < 0) { @@ -8776,6 +8786,9 @@ libvirt_virDomainBlockCopy(PyObject *self ATTRIBUTE_UNUSED, VIR_N_ELEMENTS(virPyDomainBlockCopyParams)) < 0) { return NULL; } + } else { + PyErr_Format(PyExc_TypeError, "block params must be a dictionary"); + return NULL; } dom = (virDomainPtr) PyvirDomain_Get(pyobj_dom); -- 2.17.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list