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

Signed-off-by: Peter Krempa <[email protected]>
---
 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

Reply via email to