[libvirt] [PATCH 1/6] virqemu: Reflect return type of virJSONValueArraySize()

Michal Privoznik mprivozn at redhat.com
Thu Aug 4 07:47:45 UTC 2016


The virJSONValueArraySize() function return ssize_t (with
possibly returning -1 if the passed json is not an array).
Storing the return value into size_t is possibly dangerous then.

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 src/util/virqemu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/util/virqemu.c b/src/util/virqemu.c
index a1ba562..0b516fc 100644
--- a/src/util/virqemu.c
+++ b/src/util/virqemu.c
@@ -85,7 +85,7 @@ virQEMUBuildCommandLineJSONArrayNumbered(const char *key,
                                          virBufferPtr buf)
 {
     const virJSONValue *member;
-    size_t nelems = virJSONValueArraySize(array);
+    ssize_t nelems = virJSONValueArraySize(array);
     char *prefix = NULL;
     size_t i;
     int ret = 0;
-- 
2.8.4




More information about the libvir-list mailing list