diff options
author | Max Reitz <mreitz@redhat.com> | 2014-02-21 19:11:39 +0100 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2014-02-21 22:11:17 +0100 |
commit | ae39c4b2015dd5ee35021d0f4212bb1304106524 (patch) | |
tree | ec87a0a025d324711d5541cc939f31fbc5ed52dd /util | |
parent | a33cc31d08eb46ec2a4f214087c99e4bd4c907e9 (diff) | |
download | qemu-ae39c4b2015dd5ee35021d0f4212bb1304106524.tar.gz qemu-ae39c4b2015dd5ee35021d0f4212bb1304106524.tar.bz2 qemu-ae39c4b2015dd5ee35021d0f4212bb1304106524.zip |
qemu-config: Sections must consist of keys
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 <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'util')
-rw-r--r-- | util/qemu-config.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/util/qemu-config.c b/util/qemu-config.c index 797df71569..f6101012c0 100644 --- a/util/qemu-config.c +++ b/util/qemu-config.c @@ -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); |