[PATCH 002/103] virJSONValueObjectAddVArgs: Add check for presence of the ':' separator

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Enforce that the ':' separator between the key and value is always
present.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/util/virjson.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/util/virjson.c b/src/util/virjson.c
index 70ea71b505..d7e72af8f9 100644
--- a/src/util/virjson.c
+++ b/src/util/virjson.c
@@ -161,9 +161,9 @@ virJSONValueObjectAddVArgs(virJSONValue *obj,

     while ((key = va_arg(args, char *)) != NULL) {

-        if (strlen(key) < 3) {
+        if (strlen(key) < 3 || key[1] != ':') {
             virReportError(VIR_ERR_INTERNAL_ERROR,
-                           _("argument key '%s' is too short, missing type prefix"),
+                           _("argument key '%s' is too short or malformed"),
                            key);
             return -1;
         }
-- 
2.31.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux