]> Git Repo - qemu.git/commitdiff
qemu-config: Sections must consist of keys
authorMax Reitz <[email protected]>
Fri, 21 Feb 2014 18:11:39 +0000 (19:11 +0100)
committerKevin Wolf <[email protected]>
Fri, 21 Feb 2014 21:11:17 +0000 (22:11 +0100)
In config_parse_qdict_section(), the QList returned by
qdict_array_split() is assumed to only contain QDicts. Currently, this
is true but it may (and will) change in the future. Therefore, check
whether the assumption actually holds.

Signed-off-by: Max Reitz <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
util/qemu-config.c

index 797df715697d0bf56a659b5dd42d2c36ac3ef482..f6101012c02f689a3af34082e745d0f593318e7b 100644 (file)
@@ -413,6 +413,12 @@ static void config_parse_qdict_section(QDict *options, QemuOptsList *opts,
             QDict *section = qobject_to_qdict(qlist_entry_obj(list_entry));
             char *opt_name;
 
+            if (!section) {
+                error_setg(errp, "[%s] section (index %u) does not consist of "
+                           "keys", opts->name, i);
+                goto out;
+            }
+
             opt_name = g_strdup_printf("%s.%u", opts->name, i++);
             subopts = qemu_opts_create(opts, opt_name, 1, &local_err);
             g_free(opt_name);
This page took 0.026451 seconds and 4 git commands to generate.