From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52240) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WGyLy-0002mf-55 for qemu-devel@nongnu.org; Fri, 21 Feb 2014 17:14:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WGyLr-0000eF-TV for qemu-devel@nongnu.org; Fri, 21 Feb 2014 17:13:54 -0500 Received: from mx1.redhat.com ([209.132.183.28]:8182) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WGyLr-0000e5-M5 for qemu-devel@nongnu.org; Fri, 21 Feb 2014 17:13:47 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s1LMDlUB018663 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 21 Feb 2014 17:13:47 -0500 From: Kevin Wolf Date: Fri, 21 Feb 2014 23:12:34 +0100 Message-Id: <1393020771-32712-38-git-send-email-kwolf@redhat.com> In-Reply-To: <1393020771-32712-1-git-send-email-kwolf@redhat.com> References: <1393020771-32712-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PULL 37/54] qemu-config: Sections must consist of keys List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com From: Max Reitz 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 Reviewed-by: Eric Blake Signed-off-by: Kevin Wolf --- util/qemu-config.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/util/qemu-config.c b/util/qemu-config.c index 797df71..f610101 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); -- 1.8.1.4