Commit 2b4bd07e authored by John Ferlan's avatar John Ferlan

Add check for params, nparams being a dictionary

If PyDict_Check fails, we should force an error rather than
blindly continuing on.
Signed-off-by: 's avatarJohn Ferlan <jferlan@redhat.com>
Reviewed-by: Pavel Hrdina's avatarPavel Hrdina <phrdina@redhat.com>
parent 1479577a
......@@ -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, &params, &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, &params, &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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment