Currently devAliases in virDomainFSInfo struct are iterated as a
NULL-terminated list, but that is not guaranteed. It should use
ndevAliases which stores the number of the items in devAliases.
Signed-off-by: Tomoki Sekiyama <tomoki.sekiyama(a)hds.com>
---
libvirt-override.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/libvirt-override.c b/libvirt-override.c
index 7ef66b7..e51c44d 100644
--- a/libvirt-override.c
+++ b/libvirt-override.c
@@ -8334,8 +8334,8 @@ libvirt_virDomainGetFSInfo(PyObject *self ATTRIBUTE_UNUSED, PyObject
*args) {
PyObject *pyobj_domain;
unsigned int flags;
virDomainFSInfoPtr *fsinfo = NULL;
- char **dev;
int c_retval, i;
+ size_t j;
PyObject *py_retval = NULL;
if (!PyArg_ParseTuple(args, (char *)"Oi:virDomainFSInfo",
@@ -8373,8 +8373,9 @@ libvirt_virDomainGetFSInfo(PyObject *self ATTRIBUTE_UNUSED, PyObject
*args) {
PyTuple_SetItem(info, 2, libvirt_constcharPtrWrap(fs->fstype));
PyTuple_SetItem(info, 3, alias);
- for (dev = fs->devAlias; dev && *dev; dev++)
- if (PyList_Append(alias, libvirt_constcharPtrWrap(*dev)) < 0)
+ for (j = 0; j < fs->ndevAlias; j++)
+ if (PyList_Append(alias,
+ libvirt_constcharPtrWrap(fs->devAlias[j])) < 0)
goto cleanup;
}