]> xenbits.xensource.com Git - libvirt.git/commitdiff
virqemu: Reflect return type of virJSONValueArraySize()
authorMichal Privoznik <mprivozn@redhat.com>
Wed, 3 Aug 2016 06:32:44 +0000 (08:32 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 4 Aug 2016 13:30:38 +0000 (15:30 +0200)
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@redhat.com>
src/util/virqemu.c

index a1ba562ad21ce525ac384828786f30d19b4d231b..0b516fc71bff0ddd0478c89be8527edcaf1b88fb 100644 (file)
@@ -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;