From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57347) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WGuX7-0005Gk-US for qemu-devel@nongnu.org; Fri, 21 Feb 2014 13:09:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WGuX1-0006LI-Ef for qemu-devel@nongnu.org; Fri, 21 Feb 2014 13:09:09 -0500 Received: from mx1.redhat.com ([209.132.183.28]:64234) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WGuX1-0006LE-6r for qemu-devel@nongnu.org; Fri, 21 Feb 2014 13:09:03 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s1LI92xE010483 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 21 Feb 2014 13:09:02 -0500 From: Max Reitz Date: Fri, 21 Feb 2014 19:11:39 +0100 Message-Id: <1393006301-22514-2-git-send-email-mreitz@redhat.com> In-Reply-To: <1393006301-22514-1-git-send-email-mreitz@redhat.com> References: <1393006301-22514-1-git-send-email-mreitz@redhat.com> Subject: [Qemu-devel] [PATCH 1/3] 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: Kevin Wolf , Stefan Hajnoczi , 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 --- 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.9.0